-
-
Couldn't load subscription status.
- Fork 10.8k
[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 <pandaleefree@gmail.com>
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.
0b49a76 to
4fc3209
Compare
82bc9e6 to
8f1b7b7
Compare
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
096aaa9 to
af92bb2
Compare
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
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 <pandaleefree@gmail.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: charlifu <charlifu@amd.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: gaojc <1055866782@qq.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
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.mdandexamplesfor a new model.