spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

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

Open micuentadecasa opened this issue 9 months ago • 0 comments

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

micuentadecasa avatar Apr 01 '25 10:04 micuentadecasa