Skip to content
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

hf_hub_download doesn't retry on ReadTimeout #1526

Closed
alexmojaki opened this issue Jun 22, 2023 · 2 comments
Closed

hf_hub_download doesn't retry on ReadTimeout #1526

alexmojaki opened this issue Jun 22, 2023 · 2 comments

Comments

@alexmojaki
Copy link

I got a test failure in https://app.circleci.com/pipelines/github/huggingface/transformers/66984/workflows/0a4f87b2-f6eb-4a8f-ba6f-8edead4065fd/jobs/835240 that came down to a ReadTimeout. Here's part of the traceback:

../.pyenv/versions/3.8.12/lib/python3.8/site-packages/huggingface_hub/file_download.py:1364: in hf_hub_download
    http_get(
../.pyenv/versions/3.8.12/lib/python3.8/site-packages/huggingface_hub/file_download.py:505: in http_get
    r = _request_wrapper(
../.pyenv/versions/3.8.12/lib/python3.8/site-packages/huggingface_hub/file_download.py:442: in _request_wrapper
    return http_backoff(
../.pyenv/versions/3.8.12/lib/python3.8/site-packages/huggingface_hub/utils/_http.py:212: in http_backoff
    response = session.request(method=method, url=url, **kwargs)

In particular in _request_wrapper is this line:

retry_on_exceptions=(ConnectTimeout, ProxyError),

I don't know the reasoning behind this choice of exceptions to retry, but failures in CI where the network is presumably good seems like a data point in favour of adding ReadTimeout to that tuple.

@Wauplin
Copy link
Contributor

Wauplin commented Jun 26, 2023

Thanks for opening the issue @alexmojaki. I opened a PR (#1529) to fix this. No strong choice on the (ConnectTimeout, ProxyError) tuple in my opinion. I think ReadTimeout has been forgotten just because it's a quite rare issue.

@Wauplin
Copy link
Contributor

Wauplin commented Jun 26, 2023

Fix by #1529.

@Wauplin Wauplin closed this as completed Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants