- 在Anaconda Prompt中设置镜像huggingface环境
**
windows系统
**
(FL) C:\Users\yoyo>setx HF_ENDPOINT "https://hf-mirror.com"
成功: 指定的值已得到保存。
**
linux系统
**
root@autodl-container-c77645a3ce-bcea96a6:~# export HF_ENDPOINT "https://hf-mirror.com"
bash: export: `https://hf-mirror.com': not a valid identifier
root@autodl-container-c77645a3ce-bcea96a6:~# export HF_ENDPOINT="https://hf-mirror.com"
root@autodl-container-c77645a3ce-bcea96a6:~# export HF_ENDPOINT="https://hf-mirror.com"
root@autodl-container-c77645a3ce-bcea96a6:~# echo $HF_ENDPOINT
https://hf-mirror.com
- 在代码中设置镜像,在from sentence_transformers import SentenceTransformer之前设置
import os os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" os.environ["HF_HUB_ENABLE_HF_MIRROR"] = "true" from sentence_transformers import SentenceTransformer