mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 09:14:32 +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)
|
n_words = sum(len(ex.predicted) for ex in dev_examples)
|
||||||
|
batch_size = cfg.get("evaluation_batch_size", 128)
|
||||||
start_time = timer()
|
start_time = timer()
|
||||||
|
|
||||||
if optimizer.averages:
|
if optimizer.averages:
|
||||||
with nlp.use_params(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:
|
else:
|
||||||
scorer = nlp.evaluate(dev_examples, batch_size=32)
|
scorer = nlp.evaluate(dev_examples, batch_size=eval_batch_size)
|
||||||
end_time = timer()
|
end_time = timer()
|
||||||
wps = n_words / (end_time - start_time)
|
wps = n_words / (end_time - start_time)
|
||||||
scores = scorer.scores
|
scores = scorer.scores
|
||||||
|
|
Loading…
Reference in New Issue
Block a user