extend test to training with replaced tok2vec layer

This commit is contained in:
svlandeg 2021-05-12 11:32:22 +02:00
parent d5bbd1f94f
commit ece8be4fec
1 changed files with 7 additions and 0 deletions

View File

@ -218,6 +218,13 @@ def test_replace_listeners():
nlp.replace_listeners("tok2vec", "tagger", ["model.yolo"])
with pytest.raises(ValueError):
nlp.replace_listeners("tok2vec", "tagger", ["model.tok2vec", "model.yolo"])
# attempt training with the new pipeline
optimizer = nlp.initialize(lambda: examples)
for i in range(2):
losses = {}
nlp.update(examples, sgd=optimizer, losses=losses)
assert losses["tok2vec"] == 0.0
assert losses["tagger"] > 0.0
cfg_string_multi = """