-
Notifications
You must be signed in to change notification settings - Fork 571
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 thread-safety when fetching user secret in Google Colab #1953
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. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1953 +/- ##
==========================================
- Coverage 82.15% 82.14% -0.02%
==========================================
Files 66 66
Lines 8133 8138 +5
==========================================
+ Hits 6682 6685 +3
- Misses 1451 1453 +2 ☔ View full report in Codecov by Sentry. |
this fixed it for me, thank youuu |
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.
might be worth asking the Colab team for a super quick review?
Yes we're in contact by email and slack about this specific issue (and PR). |
So good news, I have been able to consistently reproduce the deadlock issue reported in #1944, #1952, huggingface/diffusers#6431, googlecolab/colabtools#4272, huggingface/diffusers#6441 and huggingface/diffusers#6446. I tested installing In practice, this PR:
Once this PR is approved and merged, I'll proceed with a hot-fix release ( Temporary fixIn the meantime, anyone facing this deadlock issue can fix it by installing a different version of
# run before executing any code
!pip install -U huggingface_hub Note: you must install |
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!
Co-authored-by: Omar Sanseviero <osanseviero@gmail.com>
Thanks for the review @osanseviero! |
* Fix thread-safety when fetching user secret * unused var * request secret only once * Update src/huggingface_hub/utils/_token.py Co-authored-by: Omar Sanseviero <osanseviero@gmail.com> --------- Co-authored-by: Omar Sanseviero <osanseviero@gmail.com>
Update: hot-fix release 0.20.2 is now published (see release notes). The plan is to make this the default in google colab. In the meantime, upgrade
|
Update: |
Should fix #1952.
It looks like
google.colab.userdata
usesblocking_request
under the hood which statesI'm not 100% sure this is what caused the issue experienced by @prhbrt in #1952 but in any case it's better to fix it. The only change in this PR is to put the=> I'm now sure this is the problem. More details in #1953 (comment).userdata.get("HF_TOKEN")
call inside a global lock. This shouldn't impact much the performances/user experience given it's supposed to be much much quicker than uploading/downloading files.