mirror of https://github.com/explosion/spaCy.git
Add batch size argument to Language.evaluate(). Closes #3263
This commit is contained in:
parent
f135d663f7
commit
f2fae1f186
|
@ -573,7 +573,7 @@ class Language(object):
|
||||||
proc._rehearsal_model = deepcopy(proc.model)
|
proc._rehearsal_model = deepcopy(proc.model)
|
||||||
return self._optimizer
|
return self._optimizer
|
||||||
|
|
||||||
def evaluate(self, docs_golds, verbose=False):
|
def evaluate(self, docs_golds, verbose=False, batch_size=256):
|
||||||
scorer = Scorer()
|
scorer = Scorer()
|
||||||
docs, golds = zip(*docs_golds)
|
docs, golds = zip(*docs_golds)
|
||||||
docs = list(docs)
|
docs = list(docs)
|
||||||
|
@ -582,7 +582,7 @@ class Language(object):
|
||||||
if not hasattr(pipe, "pipe"):
|
if not hasattr(pipe, "pipe"):
|
||||||
docs = (pipe(doc) for doc in docs)
|
docs = (pipe(doc) for doc in docs)
|
||||||
else:
|
else:
|
||||||
docs = pipe.pipe(docs, batch_size=256)
|
docs = pipe.pipe(docs, batch_size=batch_size)
|
||||||
for doc, gold in zip(docs, golds):
|
for doc, gold in zip(docs, golds):
|
||||||
if verbose:
|
if verbose:
|
||||||
print(doc)
|
print(doc)
|
||||||
|
|
Loading…
Reference in New Issue