-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[Core] Optimize LoRA weight loading #25403
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
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[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.
Code Review
This pull request optimizes LoRA weight loading by changing the memory layout of LoRA tensors to avoid costly transpose operations. The changes are consistently applied across all relevant layers and utility functions. The new convention for lora_a
is (rank, input_dim)
and for lora_b
is (output_dim, rank)
, which matches how they are often stored in checkpoints, thus removing the need for transposition during loading. The slicing and copying logic has been updated accordingly. The changes are correct and contribute to better performance. I have no high or critical severity comments.
Signed-off-by: Jee Jee Li <[email protected]>
0b49a76
to
4fc3209
Compare
Signed-off-by: Jee Jee Li <[email protected]>
82bc9e6
to
8f1b7b7
Compare
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
096aaa9
to
af92bb2
Compare
Signed-off-by: Jee Jee Li <[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.
LGTM!
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Naman Lalit <[email protected]>
Purpose
Gemmi's description is very detailed and can slightly reduce the loading time for LoRA weights.
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.