Search code examples
pythonmachine-learningnlpspacynamed-entity-recognition

Spacy error in loading pretrained custom model with entity rulers and ner pipeline


I used a spacy blank model with Gensim custom word vectors. Then I trained the model to get the pipeline in the respective order-

entityruler1, ner1, entity ruler2, ner2

After training it, I saved it in a folder through

nlp.to_disk('path to folder')

However, if I try to load the same model using nlp1 = spacy.load('path to folder') It gives me this error-

ValueError: [E109] Model for component 'ner' not initialized. Did you forget to load a model, or forget to call begin_training()?

I cannot find any solution online. What might be the reason I am getting this? How do I successfully load and use my pretrained model?


Solution

  • Upgrading to spacy version 2.3.7 resolved this error. :)