Skip to content
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

[Feat] Add sleep_time for Spaces #1438

Merged
merged 6 commits into from
Apr 17, 2023
Merged

[Feat] Add sleep_time for Spaces #1438

merged 6 commits into from
Apr 17, 2023

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Apr 13, 2023

This PR adds a new set_space_sleep_time method to set a custom sleeping time for Spaces. By default, a (paid) upgraded hardware will never go to sleep while a cpu-basic goes to sleep after 48h. Only upgraded hardware can be configured.

TODO:

  • implement set_space_sleep_time
  • adapt the existing request_space_hardware (it's possible to request hardware + set timeout in a single call)
  • add sleep_time to the returned SpaceRuntime data structure
  • add tests and docs
  • set sleep_time at repo creation? (not possible yet server-side - see internal issue https://github.com/huggingface/moon-landing/issues/6017)

cc @abidlabs will be helpful for gradio-app/gradio#3809

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 13, 2023

The documentation is not available anymore as the PR was closed or merged.

@Wauplin Wauplin added this to the in next release? milestone Apr 17, 2023
@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Patch coverage: 94.73% and project coverage change: +0.03 🎉

Comparison is base (25e20ef) 84.34% compared to head (dbcc990) 84.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1438      +/-   ##
==========================================
+ Coverage   84.34%   84.37%   +0.03%     
==========================================
  Files          52       52              
  Lines        5430     5448      +18     
==========================================
+ Hits         4580     4597      +17     
- Misses        850      851       +1     
Impacted Files Coverage Δ
src/huggingface_hub/__init__.py 75.75% <ø> (ø)
src/huggingface_hub/hf_api.py 88.97% <94.11%> (+0.07%) ⬆️
src/huggingface_hub/_space_api.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines 21 to 23
# This value might change in the future. It is only used to trigger a warning if the user tries to set a different value
# on a free Space.
CPU_BASIC_SLEEP_TIME = 48 * 3600 # 48 hours
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should always send a warning no matter the value if the user tries to configure sleep time on a free space?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep actually why not, that would simplify the logic 👍

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Wauplin Wauplin merged commit 2dbe49e into main Apr 17, 2023
@Wauplin Wauplin deleted the feat-set-space-timeout branch April 17, 2023 14:52
@Wauplin
Copy link
Contributor Author

Wauplin commented Apr 17, 2023

Thanks for the reviews! I'm merging this PR :)
(I removed CPU_BASIC_SLEEP_TIME in the end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants