Fix tok2vec loading in spacy train

This commit is contained in:
Matthew Honnibal 2018-11-15 23:34:54 +00:00
parent 2ddd428834
commit 2874b8efd8
2 changed files with 5 additions and 1 deletions

View File

@ -213,7 +213,7 @@ def _load_pretrained_tok2vec(nlp, loc):
loaded = []
for name, component in nlp.pipeline:
if hasattr(component, 'model') and hasattr(component.model, 'tok2vec'):
component.model.tok2vec.from_bytes(weights_data)
component.tok2vec.from_bytes(weights_data)
loaded.append(name)
return loaded

View File

@ -126,6 +126,10 @@ cdef class Parser:
def __reduce__(self):
return (Parser, (self.vocab, self.moves, self.model), None, None)
@property
def tok2vec(self):
return self.model.tok2vec
@property
def move_names(self):