mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Fixes "Error saving model" #1622
This commit is contained in:
parent
568130ce7c
commit
20ae0c459a
|
@ -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)
|
||||
with nlp.use_params(optimizer.averages):
|
||||
final_model_path = output_path / 'model-final'
|
||||
nlp.to_disk(final_model_path)
|
||||
|
||||
|
||||
def _render_parses(i, to_render):
|
||||
|
|
Loading…
Reference in New Issue
Block a user