'Could not find function 'spacy-transformers.TransformerModel.v3' in function registry 'architectures'
I was trying to create a custom NER model. I used spacy library to create the model. And this line of code is to create the config file from the base.config
file.
My code is :
!python -m spacy init fill-config /content/drive/MyDrive/NER_RE_New/NER/base_config.cfg /content/drive/MyDrive/NER_RE_New/NER/config.cfg
Error :
catalogue.RegistryError: [E893] Could not find function 'spacy-transformers.TransformerModel.v3' in function registry 'architectures'. If you're using a custom function, make sure the code is available. If the function is provided by a third-party package, e.g. spacy-transformers, make sure the package is installed in your environment.
Available names:
spacy-legacy.CharacterEmbed.v1,
spacy-legacy.HashEmbedCNN.v1,
spacy-legacy.MaxoutWindowEncoder.v1,
spacy-legacy.MishWindowEncoder.v1,
spacy-legacy.MultiHashEmbed.v1,
spacy-legacy.TextCatBOW.v1,
spacy-legacy.TextCatCNN.v1,
spacy-legacy.TextCatEnsemble.v1,
spacy-legacy.Tok2Vec.v1,
spacy-legacy.TransitionBasedParser.v1,
spacy-transformers.Tok2VecTransformer.v1,
spacy-transformers.TransformerListener.v1,
spacy-transformers.TransformerModel.v1,
spacy.CharacterEmbed.v1,
spacy.EntityLinker.v1,
spacy.HashEmbedCNN.v1,
spacy.MaxoutWindowEncoder.v2,
spacy.MishWindowEncoder.v2,
spacy.MultiHashEmbed.v1,
spacy.PretrainCharacters.v1,
spacy.PretrainVectors.v1,
spacy.Tagger.v1,
spacy.TextCatBOW.v1,
spacy.TextCatCNN.v1,
spacy.TextCatEnsemble.v2,
spacy.TextCatLowData.v1,
spacy.Tok2Vec.v2,
spacy.Tok2VecListener.v1,
spacy.TorchBiLSTMEncoder.v1,
spacy.TransitionBasedParser.v1,
spacy.TransitionBasedParser.v2
Solution 1:[1]
This happened since spacy had a new update 3.1 recently. And the base_config file have the architecture mentioned as "spacy-transformers.TransformerModel.v3". Change it into "spacy-transformers.TransformerModel.v1"
[components.transformer.model]
@architectures = "spacy-transformers.TransformerModel.v1"
name = "roberta-base"
tokenizer_config = {"use_fast": true}
Solution 2:[2]
Alright, I was having the same problem. I just figured out that the problem is caused when you install spacy-transformers library this way: pip install spacy[transformers]
.
The solution:
Install it directly from their GitHub repo like this:
pip install git+https://github.com/explosion/spacy-transformers
Solution 3:[3]
resolve this error by:, execute the below lines on cmd, jupyter anywhere:
- install the latest spacy, pip install spacy
- install latest en core web sm, python -m spacy download en_core_web_sm
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | RITHIK ALIAS |
Solution 2 | Rennan Valadares |
Solution 3 | Shrashti |