Linux访问Hugging face错误失败的解决办法!!!hugging face 访问下载预训练模型失败解决办法


报错内容

提示:这里e couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like openai/clip-vit-base-patch32 is not the path to a directory containing a file named preprocessor_config.json.:

例如:这就说明你电脑不能访问hugging face。尝试过挂载vp{n} 没有得到解决。


提示:以下是本篇文章正文内容,下面案例可供参考

下面提供一个镜像地址: http://hf-mirror.com

方法一:使用huggingface 官方提供的 huggingface-cli 命令行工具。

(1) 安装依赖pip install -U huggingface_hub
(2) 基本命令示例:export HF_ENDPOINT=https://hf-mirror.comhuggingface-cli download --resume-download --local-dir-use-symlinks False bigscience/bloom-560m --local-dir bloom-560m
(3) 下载需要登录的模型(Gated Model)请添加–token hf_xxx参数,其中hf_xxx是 access token,请在huggingface官网这里获取。

示例:huggingface-cli download --token hf_*** --resume-download --local-dir-use-symlinks False meta-llama/Llama-2-7b-hf --local-dir Llama-2-7b-hf

方法二:使用url直接下载时,将 huggingface.co 直接替换为本站域名hf-mirror.com。

使用浏览器或者 wget -c、curl -L、aria2c 等命令行方式即可。下载需登录的模型需命令行添加 --header hf_xxx参数,token 获取具体参见上文。

方法三:(非侵入式,能解决大部分情况)

huggingface 提供的包会获取系统变量,所以可以使用通过设置变量来解决。
HF_ENDPOINT=https://hf-mirror.com python your_script.py

总结

提示:这里对文章进行总结:
欢迎关注我们的宫中皓,我们会分享更多坑!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值