RITHIK ALIAS
RITHIK ALIAS

Reputation: 41

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

Upvotes: 2

Views: 5500

Answers (4)

Anmol Deep
Anmol Deep

Reputation: 683

When I updated the version from 3.4.7, the issue was resolved.

Upvotes: 0

Shrashti
Shrashti

Reputation: 19

resolve this error by:, execute the below lines on cmd, jupyter anywhere:

  1. install the latest spacy: pip install spacy
  2. install latest en core web sm: python -m spacy download en_core_web_sm

Upvotes: 1

Rennan Valadares
Rennan Valadares

Reputation: 193

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

Upvotes: 1

RITHIK ALIAS
RITHIK ALIAS

Reputation: 41

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}

Upvotes: 2

Related Questions