Fix averaging in textcat example (closes #2745) (#3032) [ci skip]

This commit is contained in:
Matthew Honnibal 2018-12-08 13:27:05 +01:00 committed by Ines Montani
parent 8c0f0f50bc
commit e5685d98a2
1 changed files with 2 additions and 1 deletions

View File

@ -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