-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[LoRA] Freezing the model weights #2245
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
Conversation
Freeze the model weights since we don't need to calculate grads for them.
The documentation is not available anymore as the PR was closed or merged. |
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.
This makes sense to me! @patil-suraj @williamberman could you also take a quick look?
unet.requires_grad_(False) | ||
vae.requires_grad_(False) | ||
|
||
params = itertools.chain( |
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.
Why not just to text_encoder.requires_grad_(False)
?
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.
+1, , this way of freezing is only needed for the textual inversion
here we can use text_encoder.requires_grad_(False)
Also cc @sayakpaul - I think we can freeze everything here just like we do for dreambooth_lora |
+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 for the PR, looks good, just left one comment about freezing text encoder.
unet.requires_grad_(False) | ||
vae.requires_grad_(False) | ||
|
||
params = itertools.chain( |
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.
+1, , this way of freezing is only needed for the textual inversion
here we can use text_encoder.requires_grad_(False)
Co-authored-by: Patrick von Platen <[email protected]>
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.
Makes complete sense to me!
Thanks a lot @erkams ! |
* [LoRA] Freezing the model weights Freeze the model weights since we don't need to calculate grads for them. * Apply suggestions from code review Co-authored-by: Patrick von Platen <[email protected]> * Apply suggestions from code review --------- Co-authored-by: Patrick von Platen <[email protected]> Co-authored-by: Suraj Patil <[email protected]>
As in original lora repository freezing the weights of the models helps us to use less memory