From c4698f5712fe4b20a0156ff8e288ab82a4ef475e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 25 Jun 2018 16:36:42 +0200 Subject: [PATCH] Don't collate model unless training succeeds --- spacy/cli/train.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/spacy/cli/train.py b/spacy/cli/train.py index b4ea41114..681b8de61 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -187,14 +187,15 @@ def train(lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0, with nlp.use_params(optimizer.averages): final_model_path = output_path / 'model-final' nlp.to_disk(final_model_path) - components = [] - if not no_parser: - components.append('parser') - if not no_tagger: - components.append('tagger') - if not no_entities: - components.append('ner') - _collate_best_model(meta, output_path, components) + components = [] + if not no_parser: + components.append('parser') + if not no_tagger: + components.append('tagger') + if not no_entities: + components.append('ner') + _collate_best_model(meta, output_path, components) + def _collate_best_model(meta, output_path, components): bests = {}