From 8a693c2605df8ebf2c5521e2f419bc7d57ebb950 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 31 May 2017 02:59:18 +0200 Subject: [PATCH 1/2] Write binary file during training --- spacy/cli/train.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spacy/cli/train.py b/spacy/cli/train.py index b1e9446ed..a2c06c571 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -88,8 +88,11 @@ def train(cmd, lang, output_dir, train_data, dev_data, n_iter=20, n_sents=0, with nlp.use_params(optimizer.averages): with (output_path / ('model%d.pickle' % i)).open('wb') as file_: dill.dump(nlp, file_, -1) - with (output_path / ('model%d.pickle' % i)).open('rb') as file_: - nlp_loaded = dill.load(file_) + with (output_path / ('model%d.bin' % i)).open('wb') as file_: + file_.write(nlp.to_bytes()) + with (output_path / ('model%d.bin' % i)).open('rb') as file_: + nlp_loaded = lang_class(pipeline=pipeline) + nlp_loaded.from_bytes(file_.read()) scorer = nlp_loaded.evaluate(corpus.dev_docs(nlp_loaded, gold_preproc=False)) print_progress(i, losses, scorer.scores) finally: From 53a3824334551120bc30f4fa909524a4bb15f1f3 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 31 May 2017 03:01:02 +0200 Subject: [PATCH 2/2] Fix mistake in ner feature --- spacy/syntax/_state.pxd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/syntax/_state.pxd b/spacy/syntax/_state.pxd index 12ec19c16..c06851978 100644 --- a/spacy/syntax/_state.pxd +++ b/spacy/syntax/_state.pxd @@ -100,7 +100,7 @@ cdef cppclass StateC: ids[4] = this.E(0)-1 else: ids[4] = -1 - if ids[3] < (this.length+1): + if (ids[3]+1) < this.length: ids[5] = this.E(0)+1 else: ids[5] = -1