404 huggingface network_error ai_generated true

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/models/org/nonexistent-model

ID: huggingface/model-card-not-found

Also available as: JSON · Markdown · 中文
95%Fix Rate
90%Confidence
1Evidence
2023-01-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
huggingface-hub>=0.11.0 active
transformers>=4.20.0 active

Root Cause

The model identifier does not exist on the Hugging Face Hub, either due to a typo, private repository without access, or model deletion.

generic

中文

模型标识符在 Hugging Face Hub 上不存在,可能是由于拼写错误、无访问权限的私有仓库或模型被删除。

Official Documentation

https://huggingface.co/docs/hub/en/models-identifiers

Workarounds

  1. 95% success Verify the exact model identifier on the Hugging Face Hub and correct it: `model_id = 'bert-base-uncased' # correct identifier`
    Verify the exact model identifier on the Hugging Face Hub and correct it: `model_id = 'bert-base-uncased'  # correct identifier`
  2. 90% success If the model is private, log in with `huggingface-cli login` and use `token=True` in `from_pretrained()`: `model = AutoModel.from_pretrained('org/private-model', token=True)`
    If the model is private, log in with `huggingface-cli login` and use `token=True` in `from_pretrained()`: `model = AutoModel.from_pretrained('org/private-model', token=True)`
  3. 85% success Search for the model using the Hub API: `import requests; r = requests.get('https://huggingface.co/api/models?search=bert'); r.json()` to find valid identifiers.
    Search for the model using the Hub API: `import requests; r = requests.get('https://huggingface.co/api/models?search=bert'); r.json()` to find valid identifiers.

中文步骤

  1. Verify the exact model identifier on the Hugging Face Hub and correct it: `model_id = 'bert-base-uncased'  # correct identifier`
  2. If the model is private, log in with `huggingface-cli login` and use `token=True` in `from_pretrained()`: `model = AutoModel.from_pretrained('org/private-model', token=True)`
  3. Search for the model using the Hub API: `import requests; r = requests.get('https://huggingface.co/api/models?search=bert'); r.json()` to find valid identifiers.

Dead Ends

Common approaches that don't work:

  1. Adding `--use_auth_token` or `token=True` without a valid token 80% fail

    If the model does not exist at all, authentication does not help; 404 persists.

  2. Checking the model page manually but not correcting the identifier in code 90% fail

    The code still uses the wrong identifier; manual verification does not fix the programmatic call.

  3. Clearing the cache and retrying 70% fail

    The error is a server-side 404, not a cache issue; clearing cache has no effect.