named-entity-recognitionbert-language-modelspacy-3spacy-transformers

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

  • 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}