guard against empty list of docs
@@ -57,6 +57,9 @@ def forward(model: TransformerListener, docs, is_train):
if is_train:
model.verify_inputs(docs)
return model._outputs, model.backprop_and_clear
+ else:
+ if len(docs) == 0:
+ outputs = [TransformerData.empty()]
else:
outputs = [doc._.trf_data for doc in docs]
return outputs, lambda d_data: docs
