mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 17:54:39 +03:00
Only receive from listener if listener exists
This commit is contained in:
parent
cef97e4b63
commit
e4d0990857
|
@ -193,7 +193,8 @@ class Tok2Vec(Pipe):
|
||||||
batch_id = Tok2VecListener.get_batch_id(docs)
|
batch_id = Tok2VecListener.get_batch_id(docs)
|
||||||
for listener in self.listeners[:-1]:
|
for listener in self.listeners[:-1]:
|
||||||
listener.receive(batch_id, tokvecs, accumulate_gradient)
|
listener.receive(batch_id, tokvecs, accumulate_gradient)
|
||||||
self.listeners[-1].receive(batch_id, tokvecs, backprop)
|
if self.listeners:
|
||||||
|
self.listeners[-1].receive(batch_id, tokvecs, backprop)
|
||||||
if set_annotations:
|
if set_annotations:
|
||||||
self.set_annotations(docs, tokvecs)
|
self.set_annotations(docs, tokvecs)
|
||||||
return losses
|
return losses
|
||||||
|
|
Loading…
Reference in New Issue
Block a user