[1307]huggingface外网连不上解决办法

情况1

由于某些原因huggingface无法连接,还好有国内镜像,目前是可用的。
仅需在代码最上面加这两句就解决了!!!

import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"

情况2

1、下载依赖包

pip install -U huggingface_hub

2、修改环境配置(亲测加了https才能连上)

export HF_ENDPOINT=https://hf-mirror.com 

修改原理
找到huggingface_hub依赖包下载配置文件,参考下面这个地址:

/path/to/env/site-packages/huggingface_hub/constants.py

如果环境中有HF_ENDPOINT的设定就会采用该设定作为前缀,即上面镜像的https://hf-mirror.com而非默认的https://huggingface.co

参考:https://www.jianshu.com/p/645620c37c12
https://blog.csdn.net/qq_40277409/article/details/138566289
https://zhuanlan.zhihu.com/p/689290456
https://zhuanlan.zhihu.com/p/676420788

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周小董

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值