From 3a9710f35698a55822d80ded5d66239e6dcdba8a Mon Sep 17 00:00:00 2001 From: ines Date: Sun, 23 Apr 2017 15:57:53 +0200 Subject: [PATCH] Pass dev_scores to print_progress correctly (resolves #1008) Only read scores attribute if command is used with dev_data, otherwise default dev_scores to empty dict. --- spacy/cli/train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/cli/train.py b/spacy/cli/train.py index 3900c7f39..8557019c6 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -62,10 +62,10 @@ def train_model(Language, train_data, dev_data, output_path, tagger_cfg, parser_ for itn, epoch in enumerate(trainer.epochs(n_iter, augment_data=None)): for doc, gold in epoch: trainer.update(doc, gold) - dev_scores = trainer.evaluate(dev_data) if dev_data else [] + dev_scores = trainer.evaluate(dev_data).scores if dev_data else {} print_progress(itn, trainer.nlp.parser.model.nr_weight, trainer.nlp.parser.model.nr_active_feat, - **dev_scores.scores) + **dev_scores) def evaluate(Language, gold_tuples, output_path):