Add tok2vec property to parser model

This commit is contained in:
Matthew Honnibal 2018-09-13 14:08:43 +02:00
parent d6aa60139d
commit 21321cd6cf
1 changed files with 4 additions and 0 deletions

View File

@ -192,6 +192,10 @@ class ParserModel(Model):
Model.__init__(self) Model.__init__(self)
self._layers = [tok2vec, lower_model, upper_model] self._layers = [tok2vec, lower_model, upper_model]
@property
def tok2vec(self):
return self._layers[0]
def begin_update(self, docs, drop=0.): def begin_update(self, docs, drop=0.):
step_model = ParserStepModel(docs, self._layers, drop=drop) step_model = ParserStepModel(docs, self._layers, drop=drop)
def finish_parser_update(golds, sgd=None): def finish_parser_update(golds, sgd=None):