mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Wrap model saving in try/except
This commit is contained in:
parent
fd4baff475
commit
5743b06e36
|
@ -114,9 +114,12 @@ def train(cmd, lang, output_dir, train_data, dev_data, n_iter=20, n_sents=0,
|
||||||
print_progress(i, losses, scorer.scores)
|
print_progress(i, losses, scorer.scores)
|
||||||
finally:
|
finally:
|
||||||
print("Saving model...")
|
print("Saving model...")
|
||||||
with (output_path / 'model-final.pickle').open('wb') as file_:
|
try:
|
||||||
with nlp.use_params(optimizer.averages):
|
with (output_path / 'model-final.pickle').open('wb') as file_:
|
||||||
dill.dump(nlp, file_, -1)
|
with nlp.use_params(optimizer.averages):
|
||||||
|
dill.dump(nlp, file_, -1)
|
||||||
|
except:
|
||||||
|
print("Error saving model")
|
||||||
|
|
||||||
|
|
||||||
def _render_parses(i, to_render):
|
def _render_parses(i, to_render):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user