Skip to content

Commit

Permalink
FIX / Hub: Also catch for exceptions.ConnectionError (huggingface#3…
Browse files Browse the repository at this point in the history
…1469)

* Update hub.py

* Update errors

* Apply suggestions from code review

Co-authored-by: Lucain <lucainp@gmail.com>

---------

Co-authored-by: Amy Roberts <22614925+amyeroberts@users.noreply.github.com>
Co-authored-by: Lucain <lucainp@gmail.com>
  • Loading branch information
3 people authored and BernardZach committed Dec 6, 2024
1 parent fab8ae0 commit c356e85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/transformers/utils/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,14 @@ def has_file(
proxies=proxies,
timeout=10,
)
except OfflineModeIsEnabled:
except (requests.exceptions.SSLError, requests.exceptions.ProxyError):
# Actually raise for those subclasses of ConnectionError
raise
except (
requests.exceptions.ConnectionError,
requests.exceptions.Timeout,
OfflineModeIsEnabled,
):
return has_file_in_cache

try:
Expand Down

0 comments on commit c356e85

Please sign in to comment.