Update and validate config first and exit early if paths don't exist

This commit is contained in:
Ines Montani 2021-01-29 18:24:47 +11:00
parent bbb94b37c6
commit 8c15d1daec
1 changed files with 3 additions and 3 deletions

View File

@ -730,9 +730,6 @@ class Language:
)
raise ValueError(err)
pipe = self.get_pipe(pipe_name)
# Go over the listener layers and replace them
for listener in pipe_listeners:
util.replace_model_node(pipe.model, listener, tok2vec.model.copy())
# Update the config accordingly by coping the tok2vec model to all
# sections defined in the listener paths
for listener_path in listeners:
@ -745,6 +742,9 @@ class Language:
)
raise ValueError(err)
util.set_dot_to_object(pipe_cfg, listener_path, tok2vec_cfg["model"])
# Go over the listener layers and replace them
for listener in pipe_listeners:
util.replace_model_node(pipe.model, listener, tok2vec.model.copy())
def create_pipe_from_source(
self, source_name: str, source: "Language", *, name: str