当前位置:   article > 正文

torch.hub.load报错解决_torch.hub.load http error 300

torch.hub.load http error 300

  repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\site-packages\torch\hub.py", line 162, in _get_cache_or_reload
    _validate_not_a_forked_repo(repo_owner, repo_name, branch)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\site-packages\torch\hub.py", line 124, in _validate_not_a_forked_repo
    with urlopen(url) as r:
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "D:\ProgramData\Anaconda3\envs\torchenv\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: rate limit exceeded
 

设置 torch.hub._validate_not_a_forked_repo=lambda a,b,c: True即可

  1. import torch
  2. torch.hub._validate_not_a_forked_repo=lambda a,b,c: True
  3. model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_resnet50', pretrained=True,force_reload=True)
  4. # or any of these variants
  5. # model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_resnet101', pretrained=True)
  6. # model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_mobilenet_v3_large', pretrained=True)
  7. model.eval()

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号