mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-24 16:24:16 +03:00
Allow batch size to be set for evaluation in spacy train
This commit is contained in:
parent
f5532757a3
commit
c5d12d1a22
|
@ -332,13 +332,14 @@ def create_evaluation_callback(nlp, optimizer, corpus, cfg):
|
|||
)
|
||||
|
||||
n_words = sum(len(ex.predicted) for ex in dev_examples)
|
||||
batch_size = cfg.get("evaluation_batch_size", 128)
|
||||
start_time = timer()
|
||||
|
||||
if optimizer.averages:
|
||||
with nlp.use_params(optimizer.averages):
|
||||
scorer = nlp.evaluate(dev_examples, batch_size=32)
|
||||
scorer = nlp.evaluate(dev_examples, batch_size=eval_batch_size)
|
||||
else:
|
||||
scorer = nlp.evaluate(dev_examples, batch_size=32)
|
||||
scorer = nlp.evaluate(dev_examples, batch_size=eval_batch_size)
|
||||
end_time = timer()
|
||||
wps = n_words / (end_time - start_time)
|
||||
scores = scorer.scores
|
||||
|
|
Loading…
Reference in New Issue
Block a user