From e14533757bee544cb52f84e5e02a29c1e01950aa Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 21 May 2017 17:49:46 -0500 Subject: [PATCH] Use averaged params for evaluation --- spacy/cli/train.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/cli/train.py b/spacy/cli/train.py index 98fb61fa2..d3df1e9e8 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -53,7 +53,8 @@ def train(lang_id, output_dir, train_data, dev_data, n_iter, n_sents, golds = list(golds) nlp.update(docs, golds, drop=dropout, sgd=optimizer) pbar.update(len(docs)) - scorer = nlp.evaluate(corpus.dev_docs(nlp)) + with nlp.use_params(optimizer.averages): + scorer = nlp.evaluate(corpus.dev_docs(nlp)) print_progress(i, {}, scorer.scores) with (output_path / 'model.bin').open('wb') as file_: dill.dump(nlp, file_, -1)