Hugging Face "does not appear to have a file named config.json" in CI
from_pretrained needs a config.json to build the model, and the repo or path you pointed at does not contain one at the requested revision. Often the id points at a dataset, a partial upload, or a local directory missing the config.
What this error means
The load fails with "OSError: <repo> does not appear to have a file named config.json. Checkout 'https://huggingface.co/<repo>/main' for available files."
OSError: org/model-repo does not appear to have a file named config.json.
Checkout 'https://huggingface.co/org/model-repo/main' for available files.Common causes
The repo or path has no config.json at that revision
A partial upload, a wrong revision, or a local checkpoint dir that never wrote the config leaves nothing for from_pretrained to read.
The id points at the wrong resource
Pointing a model loader at a dataset repo or a subfolder without a config produces this error.
How to fix it
Point at a path that contains config.json
- Open the repo files at the target revision and confirm
config.jsonis present. - For a local checkpoint, ensure the directory has the config alongside weights.
- Pass the correct
subfolderorrevisionif the config lives elsewhere.
from transformers import AutoModel
AutoModel.from_pretrained("org/model-repo", revision="main", subfolder="checkpoint-500")Save a full model before reloading
If you trained and reloaded, make sure the save wrote the config, not only weights.
model.save_pretrained("out/") # writes config.json + weights
AutoModel.from_pretrained("out/")How to prevent it
- Confirm
config.jsonexists at the target revision before loading. - Use
save_pretrainedso configs and weights stay together. - Match the loader class to the resource kind.