-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP Error 403: rate limit exceeded when loading model #4156
Comments
I'm able to download on my local machine. With the following command
Also with
Can you give one more try @ichamatidis ? |
I tried it with both versions that you mentioned, still the same result in Google Colab and locally. I provide bellow the error output form the 0.10.0 version from Google Colab. Error OutputHTTPError Traceback (most recent call last) in () 8 frames /usr/lib/python3.7/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs) HTTPError: HTTP Error 403: rate limit exceeded |
True. I can reproduce this over Google Colab. Not locally though Here is link Unsure why colab should do that. But you can access pretrained model from |
Yeah it's a weird bug and must be recent(less than 2 weeks cause it was working normally before). Does your local machine has Windows or Linux? |
Linux Ubuntu 20.04.2 |
I have Ubuntu 21.04, so I assume it's some connection error. Thank you for your advise :) |
Issue is also observed here and I'm also able to reproduce it using Ubuntu20.04. |
This seems to be a bug in |
Yea I think it's introduced in that PR cc: @cyyever. It's probably hitting the rate limit set by github. My guess is it's only reproducible on CI machines/Google Colab since those machines might send a lot of API requests from the same public IP address so github only errors out on those. Our personal dev machines didn't hit the limit so it's not reproducible there. |
can confirm using torch==1.8.0 and restarting runtime in colab works |
Hi everyone, |
@ailzhang I can reproduce this locally and @NicolasHug seems to have hit the same in #4157. So it is not only CI machines and Colab. Bumping priority due to user activity. |
I'm getting the same error even while trying to run the torch hub models on docker containers. In my opinion, that should not happen. |
This is because we are using GitHub API to check the existence of the repo. I have submitted a PR to ignore HTTP error 403. To work around this error temporarily, you can delete line 163 on torch/hub.py
|
pytorch/pytorch#61761 for reference. |
Also @ichamatidis :
This should be either |
@NicolasHug Yeah copy-paste error, but the HTTP error persists even with wrong parameters, thus we can narrow that the error happens before any checks |
Likely something to do with pytorch=1.9:
Python 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.7.0'
>>> model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True, force_reload=True)
Downloading: "https://github.com/pytorch/vision/archive/v0.10.0.zip" to /home/ml/farleylai/.cache/torch/hub/v0.10.0.zip
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import torch
>>> torch.__version__
'1.7.1'
>>> model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True, force_reload=True)
Downloading: "https://github.com/pytorch/vision/archive/v0.10.0.zip" to /home/ml/farleylai/.cache/torch/hub/v0.10.0.zip Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.8.1'
>>> model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True, force_reload=True)
Downloading: "https://github.com/pytorch/vision/archive/v0.10.0.zip" to /home/ml/farleylai/.cache/torch/hub/v0.10.0.zip
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.9.0'
>>> model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True, force_reload=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/site-packages/torch/hub.py", line 362, in load
repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/site-packages/torch/hub.py", line 162, in _get_cache_or_reload
_validate_not_a_forked_repo(repo_owner, repo_name, branch)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/site-packages/torch/hub.py", line 124, in _validate_not_a_forked_repo
with urlopen(url) as r:
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 523, in open
response = meth(req, response)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 632, in http_response
response = self.parent.error(
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 561, in error
return self._call_chain(*args)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/home/ml/farleylai/miniconda3/envs/sinet39/lib/python3.9/urllib/request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: rate limit exceeded |
Similar as @farleylai, no dice with pytorch 1.9.0. This was working previously with pytorch 1.7.0 and 1.8.0. Although, that could be a coincidence if network issues are the problem. root@pc:~# python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.9.0a0+gitd69c22d'
>>> model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True, force_reload=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/torch/hub.py", line 362, in load
repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose)
File "/usr/local/lib/python3.8/dist-packages/torch/hub.py", line 162, in _get_cache_or_reload
_validate_not_a_forked_repo(repo_owner, repo_name, branch)
File "/usr/local/lib/python3.8/dist-packages/torch/hub.py", line 124, in _validate_not_a_forked_repo
with urlopen(url) as r:
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/usr/lib/python3.8/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/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 |
No need for more repros. This behavior was introduced in pytorch/pytorch#56138 which was shipped with |
I have a temporary fix for this problem. " base_model= torch.hub.load('pytorch/vision:v0.9.0', 'densenet121', pretrained=True, progress=True) " : gives me "HTTP Error 403: rate limit exceeded" BUT, " base_model = torchvision.models.densenet121(pretrained=True, progress=True) " : works completely fine |
Yes, this is a problem with |
Yes the hack fix for now is to use
instead of
Note that this hack has a small problem. |
This is not a hack, but a stable feature of For anyone wondering what can be loaded by Lines 1 to 21 in 300a8a4
|
Temporary fix by @malfet that he mentioned in this comment that fixes things for me:
|
That works for me too. |
You can simply download pretrained model by torchvision.model |
I was able to reproduce the error on CentOS 7 https://stackoverflow.com/questions/68901236/urllib-error-httperror-http-error-403-rate-limit-exceeded-when-loading-resnet1 |
PR#64677 just added an option model = torch.hub.load("pytorch/vision", "resnet18", skip_validation=True) |
Skip repo validation for TorchHub models due to known bug in `torch.hub` with Github CI (pytorch/vision#4156)
* Added notebook for SlowFast video recognition Notebook demonstrating conversion and inference of the SlowFast model for Action Classification using OpenVino. * Add README for SlowFast Video Recognition notebook Added README describing the objectives, contents and installation steps for the SlowFast video recognition notebook * Update README Added entries for the SlowFast video recognition notebook in notebooks overview tables * Add binder badge for SlowFast video recognition notebook * Styling changes * Fix failed build- missing dependency - Added missing dependency causing build to fail - Updated README * Use proper type classes for type hinting Use classes from the typing library for type hinting generics to ensure backward compatibility with earlier Python versions * Text and styling changes Fix typos and resolve styling issues in the SlowFast Video Recognition notebook. * Potential fix for failing build- skip torch.hub repo validation Skip repo validation for TorchHub models due to known bug in `torch.hub` with Github CI (pytorch/vision#4156) * Removed torch dependency in the data processing pipeline Use numpy instead of pytorch for processing input data to avoid torch dependency during model deployment. * style fix fix missing whitespace around arithmetic operator * Install dependencies in quiet mode * Add link to dataset
* Added notebook for SlowFast video recognition Notebook demonstrating conversion and inference of the SlowFast model for Action Classification using OpenVino. * Add README for SlowFast Video Recognition notebook Added README describing the objectives, contents and installation steps for the SlowFast video recognition notebook * Update README Added entries for the SlowFast video recognition notebook in notebooks overview tables * Add binder badge for SlowFast video recognition notebook * Styling changes * Fix failed build- missing dependency - Added missing dependency causing build to fail - Updated README * Use proper type classes for type hinting Use classes from the typing library for type hinting generics to ensure backward compatibility with earlier Python versions * Text and styling changes Fix typos and resolve styling issues in the SlowFast Video Recognition notebook. * Potential fix for failing build- skip torch.hub repo validation Skip repo validation for TorchHub models due to known bug in `torch.hub` with Github CI (pytorch/vision#4156) * Removed torch dependency in the data processing pipeline Use numpy instead of pytorch for processing input data to avoid torch dependency during model deployment. * style fix fix missing whitespace around arithmetic operator * Install dependencies in quiet mode * Add link to dataset
it works, the bug is gone. |
🐛 Bug
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Load the model
Environment
Google Colab and also local with the latest pytorch and torchvision installed
Error Output
HTTPError Traceback (most recent call last)
in ()
1 import torchvision
2
----> 3 model = torch.hub.load('pytorch/vision:v1.9.0','resnet50', pretrained=True)
8 frames
/usr/lib/python3.7/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
647 class HTTPDefaultErrorHandler(BaseHandler):
648 def http_error_default(self, req, fp, code, msg, hdrs):
--> 649 raise HTTPError(req.full_url, code, msg, hdrs, fp)
650
651 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 403: rate limit exceeded
The text was updated successfully, but these errors were encountered: