Merge pull request #1916 from tokestermw/bug/fix-not-passing-in-model-cfg-in-nlp

Bug/fix not passing in model cfg in nlp
This commit is contained in:
Matthew Honnibal 2018-02-05 01:19:40 +01:00 committed by GitHub
commit 2e7391e627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -461,7 +461,8 @@ class Language(object):
if hasattr(proc, 'begin_training'):
proc.begin_training(get_gold_tuples(),
pipeline=self.pipeline,
sgd=self._optimizer)
sgd=self._optimizer,
**cfg)
return self._optimizer
def evaluate(self, docs_golds, verbose=False):

View File

@ -0,0 +1,19 @@
# coding: utf8
from __future__ import unicode_literals
from ...language import Language
def test_simple_ner():
cfg = {
'hidden_depth': 2, # should error out
}
nlp = Language()
nlp.add_pipe(nlp.create_pipe('ner'))
nlp.get_pipe('ner').add_label('answer')
try:
nlp.begin_training(**cfg)
assert False # should error out
except ValueError:
assert True