-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Offload fixes #17810
Offload fixes #17810
Conversation
The documentation is not available anymore as the PR was closed or merged. |
@@ -2449,6 +2451,15 @@ def _find_mismatched_keys( | |||
gc.collect() | |||
|
|||
if offload_index is not None and len(offload_index) > 0: | |||
if model != model_to_load: | |||
# We need to add the prefix of the base model |
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.
(nit) Maybe make the comment a bit more explicit? Took me a bit to figure out what is going on here
# We need to add the prefix of the base model | |
# We need to add the prefix of the base model `model_to_load` to be able to correctly the weights into the task model `model` |
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.
Looks good to me! Maybe we could add a test as well or too edge casy?
* Offload fixes * Add a test
* Offload fixes * Add a test
What does this PR do?
This PR fixes a few bugs in the current offload to disk implementation via Accelerate.
offload_folder
is not created if it doesn't exists, loading to cryptic errors about missing files.offload_state_dict=True
, the weights should be reloaded inmodel_to_load
from the temporary offloadbase_model_cls
prefix since they were offloaded as weights ofmodel_to_load
and not ofmodel
.