-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
QOL improvements and doc updates #1318
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. |
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 for updating the docs and adding the convenience function. Regarding that, I have a question, see the comment.
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 for the updates! I would also add a short Utilities section in the LoRA API reference like this:
## Utilities
[[autodoc]] utils.get_linear_layer_names
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 a lot for updating the PR. It is almost good to go, just found a typo and have two small comments.
src/peft/utils/other.py
Outdated
@@ -498,3 +498,23 @@ def id_tensor_storage(tensor: torch.Tensor) -> Tuple[torch.device, int, int]: | |||
unique_id = storage_ptr(tensor) | |||
|
|||
return tensor.device, unique_id, storage_size(tensor) | |||
|
|||
|
|||
def cast_non_trainable_to_dtype(model, dtype): |
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.
Just noticing that we may want to use a different name, since the trainable parameters will also be cast. The name could give the impression that trainable parameters are left untouched.
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.
Updated the PR to use cast_mixed_precision_params
, let me know if you have better naming suggestions.
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
…ce/peft into smangrul/doc-updates-1
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 a lot, LGTM.
What does this PR do?
TaskType
cast_non_trainable_to_dtype
to cast all non-trainable parameters of the model to the givendtype
.This is meant to reduce the GPU memory usage when using PEFT methods by using half-precision dtype for non-trainable parameters.