From e5685d98a2644e515df9e21bc1aa8f003d5a02c4 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 8 Dec 2018 13:27:05 +0100 Subject: [PATCH] Fix averaging in textcat example (closes #2745) (#3032) [ci skip] --- examples/training/train_textcat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/training/train_textcat.py b/examples/training/train_textcat.py index 31db48d64..01e8fbea0 100644 --- a/examples/training/train_textcat.py +++ b/examples/training/train_textcat.py @@ -82,7 +82,8 @@ def main(model=None, output_dir=None, n_iter=20, n_texts=2000): output_dir = Path(output_dir) if not output_dir.exists(): output_dir.mkdir() - nlp.to_disk(output_dir) + with nlp.use_params(optimizer.averages): + nlp.to_disk(output_dir) print("Saved model to", output_dir) # test the saved model