Closed eaporetsky closed 4 years ago
In a very hacky way, if I just save a copy of en_core_web_md
and copy and paste the tagger/parser over it works, but obviously I don't want to do it in this way and would like to just save my model normally without the hack.
Note: when I retry the code in spacy 2.2.4
it works fine (and the saved tag map looks ok) but breaks in 2.3
Thanks for the report! This is due to a bug related to tag maps in 2.3.0 (fixed in #5641). As a workaround, copying the tagger
directory in the model should work, even if it's not the prettiest solution. I hope 2.3.1 will be ready today, if not then very soon.
This issue has been automatically closed because it was answered and there was no follow-up discussion.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
How to reproduce the behaviour
Hello,
I am trying to replace the NER pipe from spaCy's
en_core_web_md
with my own since I don't need any of the NER but I would like to keep the trained tagger and parser. The docs aren't exactly clear about this but what I do is below (using the ANIMAL training example)This all goes fine and the model successfully trains itself (the losses look normal), and the model saves and loads to disk. However when I try to create a doc object and print the ents with the new model I get this error:
My assumption is that calling
nlp.begin_training()
is also screwing up the tagger/parser, but the folder clearly has the tagger and parser in it and I disable pipes before training. However thetag_map
in this new model looks different from the tag map inen_core_web_md
. My training code is almost identical to the one in the training example https://spacy.io/usage/training#example-new-entity-typeIs there any advice on how to cleanly keep the tagger and parser from an existing model but replace the NER component (I don't want any of the built in entities) but also don't want to have to retrain a tagger and parser.
Your Environment
spaCy version 2.3.0
Location /usr/local/lib/python3.7/site-packages/spacy Platform Darwin-18.6.0-x86_64-i386-64bit Python version 3.7.7