完美解决:Failed to connect to huggingface.co port 443 after 75018 ms Operation timed out

完美解决:Failed to connect to huggingface.co port 443 after 75018 ms: Operation timed out

方案一:

选择python依赖包,用代码程序解决
推荐:pycrawlers这个python包,使用这个包可以轻松实现批量下载,以及进度显示

from pycrawlers import huggingface
# 实例化类
hg = huggingface()

# 1.批量下载
urls = ['https://huggingface.co/ziqingyang/chinese-llama-2-13b/tree/main',
        'https://huggingface.co/ziqingyang/chinese-llama-2-7b/tree/main']
           
# 默认保存位置在当前脚本所在文件夹 ./
hg.get_batch_data(urls)

# 2.单个下载
url = 'https://huggingface.co/ziqingyang/chinese-llama-2-13b/tree/main'

# 默认保存位置在当前脚本所在文件夹 ./
hg.get_data(url)


# 自定义下载位置
# 多个不同位置
paths = ['/home/model-gpt/chinese-llama-2-13b','/home/model-gpt/chinese-llama-2-7b']
hg.get_batch_data(urls, paths)

# 单一位置
path = '/home/model-gpt'
hg.get_data(url, path)

示例:
在这里插入图片描述

方案二:

重点:需要有***,简称 V ,能登github的明白【该处因某些原因不写明】

解决办法:配置V在Windows、Linux、Mac OS 中 git 命令相同(笔者是在MAC环境下进行的):

#建议socks5 和http 都配置一下

配置socks5

git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890

配置http

git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

# 主机号 127.0.0.1是使用的 V 的主机号(也就是有 V 的本机)
# 端口号 7890 指 V 的端口号,软件设置里查看(在你 V 软件里找)

查看设置:

git config --global --get http.proxy
git config --global --get https.proxy

取消办法:

git config --global --unset http.proxy
git config --global --unset https.proxy

最后正常下载

备选方案:
直接去huggingface里下载

在这里插入图片描述

  • 39
    点赞
  • 72
    收藏
    觉得还不错? 一键收藏
  • 20
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值