huggingface network_error ai_generated true

OSError: model-org/model-name is not a local folder and is not a valid model identifier listed on 'https://huggingface.co'

ID: huggingface/model-id-not-found-local-or-remote

Also available as: JSON · Markdown · 中文
90%Fix Rate
88%Confidence
1Evidence
2023-09-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
huggingface_hub>=0.16.0 active
transformers>=4.25.0 active
python>=3.8 active

Root Cause

The model identifier does not exist on Hugging Face Hub, or the local path is incorrect, often due to a typo or missing repository.

generic

中文

模型标识符在 Hugging Face Hub 上不存在,或本地路径错误,通常是由于拼写错误或仓库缺失。

Official Documentation

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

Workarounds

  1. 95% success Verify the model ID on Hugging Face Hub: https://huggingface.co/models?search=model-org/model-name. Then use correct ID: model = AutoModel.from_pretrained('correct-org/correct-model')
    Verify the model ID on Hugging Face Hub: https://huggingface.co/models?search=model-org/model-name. Then use correct ID: model = AutoModel.from_pretrained('correct-org/correct-model')
  2. 85% success Use from_pretrained with local folder path if model is downloaded manually: model = AutoModel.from_pretrained('./local_model_folder')
    Use from_pretrained with local folder path if model is downloaded manually: model = AutoModel.from_pretrained('./local_model_folder')

中文步骤

  1. 在 Hugging Face Hub 上验证模型 ID:https://huggingface.co/models?search=model-org/model-name。然后使用正确的 ID:model = AutoModel.from_pretrained('correct-org/correct-model')
  2. 如果模型已手动下载,使用本地文件夹路径:model = AutoModel.from_pretrained('./local_model_folder')

Dead Ends

Common approaches that don't work:

  1. 70% fail

    The model ID should be 'org/name' without protocol, as the library automatically resolves it.

  2. 90% fail

    local_files_only=True prevents any network access, so the model must already be cached locally.