【秒解决:huggingface_hub.utils._errors.LocalEntryNotFoundError】
报错详细
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on
问题说明
在使用到huggingface时,下载连接不稳定导致,ConnectError。
解决方式
使用镜像网站链接解决稳定性问题,可使用以下其中一种方式改变huggingface网址
源码对应位置应该是这里
1)在python代码中加入以下代码
例如运行的代码为main.py,就在main.py代码里最上面添加
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
.
..
...
if __name__=='__main__':
...
2)使用命令行修改环境变量并运行代码
#Linux
export HF_ENDPOINT="https://hf-mirror.com"
python xxx.py
#Windows Powershell
$env:HF_ENDPOINT = "https://hf-mirror.com"
python xxx.py
3)非入侵式修改环境变量运行代码
HF_ENDPOINT=https://hf-mirror.com python xxx.py
4)其他方式参考: https://hf-mirror.com
参考链接:链接