Train NER based on existing model or add custom trained NER to existing model error #7149
-
in spaCy < 3.0 I was able to train the NER component within the trained en_core_web_sm model:
Specifically, I need the tagger and in the parser of the en_core_web_lg model. These components can be added with the corresponding source and then insert to the frozen_component in the training section of the config file (I will provide my full config at the end of this question):
When I'm debugging, following error occurs: When I put tagger to the disabled components in the nlp section of the config file or if I delete everything related to the tagger, debugging and training works. However, when applying the trained model to a text loaded to a doc, only the trained NER works and none of the other components. E.g. the parser predicts everything is ROOT. I also tried to train the NER model on its own and then add it to the loaded en_core_web_sm model:
This leads to the following error: Available factories: attribute_ruler, tok2vec, merge_noun_chunks, merge_entities, merge_subtokens, token_splitter, parser, beam_parser, entity_linker, ner, beam_ner, entity_ruler, lemmatizer, tagger, morphologizer, senter, sentencizer, textcat, textcat_multilabel, en.lemmatizer` Does anyone have a suggestion how I can either train my NER with the en_core_web_sm model or how I could integrate my trained component? Here's the entire config file:
Your EnvironmentOperating System: Windows 10 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think there are a few different issues going on here:
Freezing the sourced tagger & parser should indeed work like this, and you are right to try and disconnect the
You'll see that once you do this - freezing the tagger/parser and disconnecting them from their original Now, that leaves the problem of how to deal with the NER. There are basically three options.
This means that the NER will just use its internal tok2vec layer, and in fact training the NER will NOT impact the parser/tagger - even if you don't freeze those or use
Again, this will avoid conflicts with the other tok2vec of the tagger/parser, but again it means training a new Your final point
is a little bit unclear to me. I can't reproduce it. Are you perhaps trying to run the pretrained tagger on gold data that contains labels that are not included in |
Beta Was this translation helpful? Give feedback.
I think there are a few different issues going on here:
Freezing the sourced tagger & parser should indeed work like this, and you are right to try and disconnect the
tok2vec
layer with thereplace_listeners
function. However, it's not entirely working like you think. Thetagger
andparser
just know that they're listening to an upstreamtok2vec
component, and by creating a new one withfactory = "tok2vec"
, you're basically still …