Fix Pipe base class

This commit is contained in:
Matthew Honnibal 2019-08-01 17:29:01 +02:00
parent 8718ca8b1f
commit 4632c597e7
1 changed files with 6 additions and 2 deletions

View File

@ -66,8 +66,12 @@ class Pipe(object):
and `set_annotations()` methods.
"""
self.require_model()
scores, tensors = self.predict([doc])
self.set_annotations([doc], scores, tensors=tensors)
predictions = self.predict([doc])
if isinstance(predictions, tuple) and len(tuple) == 2:
scores, tensors = predictions
self.set_annotations([doc], scores, tensor=tensors)
else:
self.set_annotations([doc], predictions)
return doc
def require_model(self):