Raise error if disk is full before downloading weights
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
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).
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!
RE CI failures: I actually now what happened here: the transformer package had a new release a few days back and this caused some issues with the rope unit tests (unrelated to this PR). I know how to fix and can take a look the next couple of days.
@Andrei-Aksionov RoPE tests should be fixed now for the latest transformer release and if tests pass on CI, this should be ready to merge.
Ok there seem to be other issues now with the Phi model. Also unrelated to this PR. Maybe microsoft changed something. Or the transformers library changed something.
Probably. I think these issues need to be resolved in separate PRs. Then merged to this one.