Only receive from listener if listener exists

This commit is contained in:
Ines Montani 2020-08-14 14:58:48 +02:00
parent cef97e4b63
commit e4d0990857

View File

@ -193,7 +193,8 @@ class Tok2Vec(Pipe):
batch_id = Tok2VecListener.get_batch_id(docs)
for listener in self.listeners[:-1]:
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:
self.set_annotations(docs, tokvecs)
return losses