tok2vec.update instead of predict (#6113)

This commit is contained in:
Sofie Van Landeghem 2020-09-22 21:54:52 +02:00 committed by GitHub
parent e0e793be4d
commit 86a08f819d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ def debug_model(
goldY = None
for e in range(3):
if tok2vec:
tok2vec.predict(X)
tok2vec.update([Example.from_dict(x, {}) for x in X])
Y, get_dX = model.begin_update(X)
if goldY is None:
goldY = _simulate_gold(Y)

View File

@ -184,7 +184,7 @@ def test_tok2vec_listener_callback():
label_sample = [tagger.model.ops.asarray(gold_array, dtype="float32")]
tagger.model.initialize(X=docs, Y=label_sample)
docs = [nlp.make_doc("Another entirely random sentence")]
tok2vec.predict(docs)
tok2vec.update([Example.from_dict(x, {}) for x in docs])
Y, get_dX = tagger.model.begin_update(docs)
# assure that the backprop call works (and doesn't hit a 'None' callback)
assert get_dX(Y) is not None