赞
踩
model = torch.hub.load('huggingface/pytorch-transformers', 'model', 'bert-base-chinese')
pytorch 1.9.0
torchvision 0.10.0
urllib.error.HTTPError: HTTP Error 403: rate limit exceeded
以下方法是可以尝试的方法
更改torch版本从1.9.0+cpu转到1.7.0
注释掉hub.py的162行的方法
_validate_not_a_forked_repo
torch.hub._validate_not_a_forked_repo=lambda a,b,c: True
应该没用,因为【torch.hub.load】我们访问的是:https://github.com/...。而不是https://api.github.com/
如果需要改变可以参考:
https://blog.csdn.net/caroline_wendy/article/details/109337216
我将torch的版本从1.9.0变成了1.8.1,但是报错:
Downloading: "https://github.com/huggingface/pytorch-transformers/archive/master.zip" to /root/.cache/torch/hub/master.zip
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:841)>
windows或Ubuntu中请求github.com请求超时,或在下载GitHub文件出现:<urlopen error [Errno 110] Connection timed out>
RuntimeError: Missing dependencies: sentencepiece
这个时候已经下载下来了
pip install --user transformers
pip install --user sentencepiece
如果安装出错,请参考:Python - 安装sentencepiece异常
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。