mirror of https://github.com/explosion/spaCy.git
call replace_listener attr if it's available
This commit is contained in:
parent
ece8be4fec
commit
44a3a58599
|
@ -1801,7 +1801,10 @@ class Language:
|
||||||
util.set_dot_to_object(pipe_cfg, listener_path, tok2vec_cfg["model"])
|
util.set_dot_to_object(pipe_cfg, listener_path, tok2vec_cfg["model"])
|
||||||
# Go over the listener layers and replace them
|
# Go over the listener layers and replace them
|
||||||
for listener in pipe_listeners:
|
for listener in pipe_listeners:
|
||||||
util.replace_model_node(pipe.model, listener, tok2vec.model.copy())
|
new_model = tok2vec.model.copy()
|
||||||
|
if "replace_listener" in new_model.attrs:
|
||||||
|
new_model = new_model.attrs["replace_listener"](new_model)
|
||||||
|
util.replace_model_node(pipe.model, listener, new_model)
|
||||||
tok2vec.remove_listener(listener, pipe_name)
|
tok2vec.remove_listener(listener, pipe_name)
|
||||||
|
|
||||||
def to_disk(
|
def to_disk(
|
||||||
|
|
Loading…
Reference in New Issue