Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load model from config file: no [nlp] section found #13782

Open
micuentadecasa opened this issue Apr 1, 2025 · 0 comments
Open

Can't load model from config file: no [nlp] section found #13782

micuentadecasa opened this issue Apr 1, 2025 · 0 comments

Comments

@micuentadecasa
Copy link

I have a config.cfg file very simple

[nlp]
lang = "el"
pipeline = ["transformer", "ner"]
components = ["transformer", "ner"]

[components]

[components.transformer]
factory = "transformer"
model = "amichailidis/greek_legal_bert_v2-finetuned-ner"

[components.ner]
factory = "ner"
source = "transformer"

and when I try to load it

config_path = "/config.cfg"

print(f"Loading model 'amichailidis/greek_legal_bert_v2-finetuned-ner' via config: {config_path}")

Load the pipeline from the configuration file

This will download the model from Hugging Face Hub if not cached

nlp = spacy.util.load_model_from_config(config_path)

print("Model loaded successfully.")

I receive this error:

File "/home/luis/projects/spacy/spacy-greek.py", line 13, in
nlp = spacy.util.load_model_from_config(config_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: [E985] Can't load model from config file: no [nlp] section found.

/config.cfg

but as you can see the config file has a nlp section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant