-
Notifications
You must be signed in to change notification settings - Fork 581
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
Clearer HTTP error messages in huggingface_hub
#1019
Conversation
The documentation is not available anymore as the PR was closed or merged. |
huggingface_hub
huggingface_hub
Codecov Report
@@ Coverage Diff @@
## main #1019 +/- ##
==========================================
+ Coverage 82.16% 82.34% +0.17%
==========================================
Files 35 35
Lines 3588 3596 +8
==========================================
+ Hits 2948 2961 +13
+ Misses 640 635 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
huggingface_hub
huggingface_hub
The warnings will pollute the use of Transformers by any user using a source install of |
@sgugger I removed the warning from In general I'm not a big fan of having a temporary alias that we need to remember about when we do the release since it requires that we synchronize ourselves on the releases. So for this one I suggest that we keep the alias without warning and starting from just after v0.10 (so not in official v0.10 release) I will deprecate it/remove it considering that Transformers no longer uses it. Would that be ok ? The only difference is that we keep the alias for one more version and in between Transformers should be able to adapt but no warnings are thrown. |
Yes, that works even better. Thanks! |
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.
Left a couple of nits, but looks great otherwise!
Thanks!
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
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.
This looks good to me! Thanks for working on it, @Wauplin, very happy to have a stable and maintained public API for hf_raise_for_status
.
Fix #989 (and duplicate #989).
What this PR do
The initial issue was about adding meaningful information to the HTTPError (especially advice like "create_commit expects the repo to exist" or "make sure you specific the right repo_id/repo_type"). This PR aims to solve that but also improve and harmonize how HTTP Errors are processed in
huggingface_hub
.It introduces:
hf_raise_for_status
-> meant to be the single way to raise for status in HF Hub. Also meant to be reused "officially" by third-party libraries liketransformers
(at the momenthuggingface_hub.utils._errors._raise_for_status
is called).HfHubHTTPError
-> a custom error that inherits fromresponse.HTTPError
and that is parents to theRepositoryNotFoundError
,RevisionNotFoundError
,... It handles the formatting of the Hub details in the error message.hf_raise_for_status
usage.At the moment,
_raise_for_status
,_raise_with_request_id
and_raise_convert_bad_request
that were doing similar things are all kept as aliases forhf_raise_for_status
. I deprecated their usage instead of removing them. I can also keep them without warning message but I like it less (cc @sgugger).Examples
I refined the error messages to have multi-line descriptions. I prefer it this way to make it clearer for the end-user but please let me know if you see a problem with that. Errors look like this:
(cc @NielsRogge @merveenoyan @cakiki who showed interest in the issue)