mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-25 00:34:20 +03:00
extend test to training with replaced tok2vec layer
This commit is contained in:
parent
d5bbd1f94f
commit
ece8be4fec
|
@ -218,6 +218,13 @@ def test_replace_listeners():
|
||||||
nlp.replace_listeners("tok2vec", "tagger", ["model.yolo"])
|
nlp.replace_listeners("tok2vec", "tagger", ["model.yolo"])
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
nlp.replace_listeners("tok2vec", "tagger", ["model.tok2vec", "model.yolo"])
|
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 = """
|
cfg_string_multi = """
|
||||||
|
|
Loading…
Reference in New Issue
Block a user