From 146af1dc17bc69b0c9813c7cd1f8f938d68fd940 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 25 Jan 2021 11:51:19 +1100 Subject: [PATCH] Allow output_path to be None during training --- spacy/training/loop.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spacy/training/loop.py b/spacy/training/loop.py index fe2d4b18f..72458181d 100644 --- a/spacy/training/loop.py +++ b/spacy/training/loop.py @@ -100,7 +100,8 @@ def train( if is_best_checkpoint is not None and output_path is not None: with nlp.select_pipes(disable=frozen_components): update_meta(T, nlp, info) - save_checkpoint(is_best_checkpoint) + if output_path is not None: + save_checkpoint(is_best_checkpoint) except Exception as e: if output_path is not None: stdout.write( @@ -113,7 +114,8 @@ def train( raise e finally: finalize_logger() - save_checkpoint(False) + if output_path is not None: + save_checkpoint(False) # This will only run if we did't hit an error if optimizer.averages: nlp.use_params(optimizer.averages)