Problem loading trained model in prodiga to spacy.

Hi, noob person over here, thanks for having me. I'm having problems loading my model to spacy, I trained it and save it --output to the folder of my project. But when I try to load it I get this error "OSError: [E053] Could not read config.cfg from ner_bci_apolo/config.cfg" I'm trying to load with:

import ner_bci_apolo
nlp = spacy.load('ner_bci_apolo')
triple check that the file does exist in the folder, try relativo and absolute path, and nothing. The model was trained using ner.teach with almost 300 annotated cases. I used a virtual environment, but when I run the script from Anaconda I'm loading the model not from that venv (does that make any sense? I'm a noob), I run anaconda using Python 3.9 and the venv is in 3.7.
I'm los getting this message:
/Users/alejandroarancibia/opt/anaconda3/lib/python3.7/site-packages/spacy/util.py:707: UserWarning: [W095] Model 'es_core_news_sm' (2.3.1) requires spaCy >=2.3.0,<2.4.0 and is incompatible with the current version (3.0.5). This may lead to unexpected results or runtime errors. To resolve this, download a newer compatible model or retrain your custom model with the current spaCy version. For more details and available updates, run: python -m spacy validate
warnings.warn(warn_msg)
Traceback (most recent call last):

============================== :sparkles: Prodigy Stats ==============================

Version 1.10.7
Location /Users/alejandroarancibia/Desktop/NLP_BNI/venv/lib/python3.7/site-packages/prodigy
Prodigy Home /Users/alejandroarancibia/.prodigy
Platform Darwin-17.7.0-x86_64-i386-64bit
Python Version 3.7.4
Database Name SQLite
Database Id sqlite
Total Datasets 1
Total Sessions 14
============================== Info about spaCy ==============================

spaCy version 2.3.5
Location /Users/alejandroarancibia/opt/anaconda3/lib/python3.7/site-packages/spacy
Platform Darwin-17.7.0-x86_64-i386-64bit
Python version 3.7.9
Models

Help please!! Thanks and congrats on this great community.

Hi and thanks! :blush:

From the error message you posted, it sounds like the spacy you're using to load the model is spaCy v3, specifically spaCy 3.0.5. However, the model was trained with spaCy v2, so it's incompatible.

It's definitely very confusing, though, because if you compare the paths to the spaCy installation in your anaconda environment, it's the same :thinking: /Users/alejandroarancibia/opt/anaconda3/lib/python3.7/site-packages/spacy/ Typically, the most common explanation for problems like this is that there are two different environments with different packages installed – but this doesn't seem to be the case here. Did you install or change anything between trying to load the model and printing the output of spacy info?

Thaks for the quik reply Ines. I was able to make it work, runing the script from the same environment whre the model was trained. So I`m all set up now.

2 Likes