mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 11:11:05 +06:00
FIX / Hub: Also catch for exceptions.ConnectionError
(#31469)
* 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>
This commit is contained in:
parent
8b94d28f97
commit
eeea71209a
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user