这个问题是由于网络限制引起的,国内网络无法访问huggingface网站,我们通过其镜像进行下载即可,即通过以下步骤即可迅速解决:
1. 找到环境中的constants.py文件
conda路径/env/环境名称/lib/python版本/site-packages/huggingface_hub/constants.py
比如:
~/anaconda3/envs/XXXX/lib/python3.9/site-packages/huggingface_hub/constants.py
2. 修改文件
HUGGINGFACE_CO_URL_HOME = "https://hf-mirror.com/"
_HF_DEFAULT_ENDPOINT = "https://hf-mirror.com"
修改完毕后保存文件,重新运行程序