Fixes "Error saving model" #1622

This commit is contained in:
Isaac Sijaranamual 2017-12-10 21:29:50 +01:00
parent 568130ce7c
commit 20ae0c459a

View File

@ -3,7 +3,6 @@ from __future__ import unicode_literals, division, print_function
import plac
from pathlib import Path
import dill
import tqdm
from thinc.neural._classes.model import Model
from timeit import default_timer as timer
@ -165,9 +164,9 @@ def train(cmd, lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0,
gpu_wps=gpu_wps)
finally:
print("Saving model...")
with (output_path / 'model-final.pickle').open('wb') as file_:
with nlp.use_params(optimizer.averages):
dill.dump(nlp, file_, -1)
final_model_path = output_path / 'model-final'
nlp.to_disk(final_model_path)
def _render_parses(i, to_render):