使用清华大学的 Hugging Face 镜像
代码
model = AutoModel.from_pretrained("Qwen/Qwen3-Embedding-0.6B-GGUF", trust_remote_code=True)
报错
raise OSError(
OSError: We couldn’t connect to 'https://huggingface.co Hugging Face – The AI community building the future. Hugging Face – The AI community building the future. ’ to load the files, and couldn’t find them in the cached files.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode Installation Installation '.
解决方式
更换国内镜像
控制台输入
export HF_ENDPOINT=https://hf-mirror.com
然后运行代码时会自动下载模型,重启终端后环境变量会自动消失
或者离线模式加载模型
下载模型文件到本地目录,然后修改目录为本地模型地址运行