执行以下语句查看当前配置
huggingface-cli env
默认输出应该如下
(py39-transformers) PS D:\py_project\transformers_demo> huggingface-cli env
Copy-and-paste the text below in your GitHub issue.
- huggingface_hub version: 0.26.1
- Platform: Windows-10-10.0.22631-SP0
- Python version: 3.9.20
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: C:\Users\root\.cache\huggingface\token
- Has saved token ?: False
- Configured git credential helpers: manager
- FastAI: N/A
- Tensorflow: N/A
- Torch: 2.5.0+cu118
- Jinja2: 3.1.3
- Graphviz: N/A
- keras: N/A
- Pydot: N/A
- Pillow: 10.2.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.3
- pydantic: N/A
- aiohttp: 3.10.10
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: C:\Users\root\.cache\huggingface\hub
- HF_ASSETS_CACHE: C:\Users\root\.cache\huggingface\assets
- HF_TOKEN_PATH: C:\Users\root\.cache\huggingface\token
- HF_STORED_TOKENS_PATH: C:\Users\root\.cache\huggingface\stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
在windows下.只需要添加2个环境变量即可成功修改
# 镜像源
HF_ENDPOINT=https://hf-mirror.com
# 缓存目录等
HF_HOME=D:\huggingface_home
如下图设置即可
重新执行命令查看是否更新
注意关闭cmd,重开,pycharm也是,不然环境变量不生效
huggingface-cli env
(py39-transformers) C:\Users\root>huggingface-cli env
Copy-and-paste the text below in your GitHub issue.
- huggingface_hub version: 0.26.1
- Platform: Windows-10-10.0.22631-SP0
- Python version: 3.9.20
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: D:\huggingface_home\token
- Has saved token ?: False
- Configured git credential helpers: manager
- FastAI: N/A
- Tensorflow: N/A
- Torch: 2.5.0+cu118
- Jinja2: 3.1.3
- Graphviz: N/A
- keras: N/A
- Pydot: N/A
- Pillow: 10.2.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.3
- pydantic: N/A
- aiohttp: 3.10.10
- ENDPOINT: https://hf-mirror.com
- HF_HUB_CACHE: D:\huggingface_home\hub
- HF_ASSETS_CACHE: D:\huggingface_home\assets
- HF_TOKEN_PATH: D:\huggingface_home\token
- HF_STORED_TOKENS_PATH: D:\huggingface_home\stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10