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

Raise error if disk is full before downloading weights #1903

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rasbt
Copy link
Collaborator

@rasbt rasbt commented Jan 8, 2025

Raises an error if a user attempts to download model weights that would exceed the current available free disk space. If this is run in a Studio, it additionally prompts the user to switch to a different Studio with more disk space.

This is a minor but important point as someone can easily shoot themselves in the foot by downloading things that exceed the available storage, because once it's full, the system may go in a weird state that doesn't allow deleting and restoring things.

Fixes #1841

@rasbt rasbt requested a review from Andrei-Aksionov January 8, 2025 23:19
@rasbt rasbt requested a review from lantiga as a code owner January 8, 2025 23:19
@Andrei-Aksionov
Copy link
Collaborator

Thanks for the PR 🚀

But there is one nuance 😊
We need to check for free disk space that is at least 2x of the model weight's size.
The code first downloads weights from HF and then converts to lit format - lit_model.pth.
Even if we change the code to delete HF weights right after the conversion, then still at the same time two sets of weights will exist (during conversion, before the deletion).

Thanks!

Co-authored-by: Andrei-Aksionov <[email protected]>
@rasbt
Copy link
Collaborator Author

rasbt commented Jan 9, 2025

But there is one nuance 😊
We need to check for free disk space that is at least 2x of the model weight's size.
The code first downloads weights from HF and then converts to lit format - lit_model.pth.
Even if we change the code to delete HF weights right after the conversion, then still at the same time two sets of weights will exist (during conversion, before the deletion).

Thanks, that's great and important point!

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.

Show a warning if there is no enough space to download weights
2 participants