mirror of https://github.com/explosion/spaCy.git
Fix tag map clobbering in spacy train (#6437)
Fix bug from #5768 where the tag map is clobbered if a custom tag map isn't provided.
This commit is contained in:
parent
ce18fc6588
commit
573f5c863f
|
@ -137,9 +137,6 @@ def train(
|
||||||
output_path.mkdir()
|
output_path.mkdir()
|
||||||
msg.good("Created output directory: {}".format(output_path))
|
msg.good("Created output directory: {}".format(output_path))
|
||||||
|
|
||||||
tag_map = {}
|
|
||||||
if tag_map_path is not None:
|
|
||||||
tag_map = srsly.read_json(tag_map_path)
|
|
||||||
# Take dropout and batch size as generators of values -- dropout
|
# Take dropout and batch size as generators of values -- dropout
|
||||||
# starts high and decays sharply, to force the optimizer to explore.
|
# starts high and decays sharply, to force the optimizer to explore.
|
||||||
# Batch size starts at 1 and grows, so that we make updates quickly
|
# Batch size starts at 1 and grows, so that we make updates quickly
|
||||||
|
@ -250,6 +247,8 @@ def train(
|
||||||
pipe_cfg = {}
|
pipe_cfg = {}
|
||||||
nlp.add_pipe(nlp.create_pipe(pipe, config=pipe_cfg))
|
nlp.add_pipe(nlp.create_pipe(pipe, config=pipe_cfg))
|
||||||
|
|
||||||
|
if tag_map_path is not None:
|
||||||
|
tag_map = srsly.read_json(tag_map_path)
|
||||||
# Replace tag map with provided mapping
|
# Replace tag map with provided mapping
|
||||||
nlp.vocab.morphology.load_tag_map(tag_map)
|
nlp.vocab.morphology.load_tag_map(tag_map)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue