explosion / explosion/spaCy

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

Open
#13,782 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
33.9k
Forks
4.7k
Avg merge
3m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.