From f2fae1f186042eadd5b74280382d5836e6df3854 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 25 Feb 2019 19:30:33 +0100 Subject: [PATCH] Add batch size argument to Language.evaluate(). Closes #3263 --- spacy/language.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index c1abb62b4..0c0cf8854 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -573,7 +573,7 @@ class Language(object): proc._rehearsal_model = deepcopy(proc.model) return self._optimizer - def evaluate(self, docs_golds, verbose=False): + def evaluate(self, docs_golds, verbose=False, batch_size=256): scorer = Scorer() docs, golds = zip(*docs_golds) docs = list(docs) @@ -582,7 +582,7 @@ class Language(object): if not hasattr(pipe, "pipe"): docs = (pipe(doc) for doc in docs) else: - docs = pipe.pipe(docs, batch_size=256) + docs = pipe.pipe(docs, batch_size=batch_size) for doc, gold in zip(docs, golds): if verbose: print(doc)