-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
FIX / Hub: Also catch for exceptions.ConnectionError
#31469
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
@younesbelkada I'm surprised that a While you are at it, you can also include read timeout and remove SSLError and ProxyError for which it's better to raise: 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 This is what we do in |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
@younesbelkada @huggingface/transformers-core-maintainers I still think this PR is worth updating + merging (see previous comment #31469 (comment)). |
@Wauplin I updated following your comments, but not 100% I'm catching in the right way. LMK! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting back to it @amyeroberts . I had a fresh look at it and I think the changes should be as suggested below. First we do the call and check for offlinemode/connection error/timeout error. And then check for httperror independently
Co-authored-by: Lucain <[email protected]>
4812b89
to
1938458
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@Wauplin Thanks for writing the correct code! As we both contributed to this - let's get a final pair of eyes to double check this is OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, this was causing some confusing indeed
…1469) * Update hub.py * Update errors * Apply suggestions from code review Co-authored-by: Lucain <[email protected]> --------- Co-authored-by: Amy Roberts <[email protected]> Co-authored-by: Lucain <[email protected]>
…1469) * Update hub.py * Update errors * Apply suggestions from code review Co-authored-by: Lucain <[email protected]> --------- Co-authored-by: Amy Roberts <[email protected]> Co-authored-by: Lucain <[email protected]>
What does this PR do?
Fixes: #30920
Please see the detailed issue description for more details, it seems in transformers we hit a corner case when using HF offline mode + loading a non-safetensors model offline
cc @Wauplin as I am not 100% sure about this and why this is not catched within
hf_raise_for_status
inhuggingface_hub