-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[Core] Support weight_loader_v2 for UnquantizedLinearMethod
#23036
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
[Core] Support weight_loader_v2 for UnquantizedLinearMethod
#23036
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
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 modernizes UnquantizedLinearMethod by adding support for weight_loader_v2. This is achieved by using ModelWeightParameter during weight creation and then converting it back to a standard torch.nn.Parameter after loading to ensure torch.compile compatibility. The changes are logical, well-contained, and correctly enable the new functionality. The implementation appears solid and aligns with the project's existing patterns.
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.
Let's run the CI and see the results
46f1244 to
142e9e6
Compare
142e9e6 to
08368f2
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
7e75806 to
28e38df
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
28e38df to
68abefe
Compare
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> Signed-off-by: gaojc <1055866782@qq.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
…roject#23036) Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Purpose
UnquantizedLinearMethodby allowing the parameter to support weight_loader_v2Changes
Parameterto an instance ofModelWeightParameterUnquantizedLinearMethodto list of weight_loader_v2 supported methodsCaveats
Typically, linear methods solve this by replacing the
BasevLLMParameterwith atorch.nn.Parameterafter weight loading. However, this prevents the weight from being reloaded (see test_reload_weights_before_load_model).The simplest solution is to get a pointer to the weight data for execution and leave the original parameter untouched. Note that accessing
dataduring execution leads to another torch.compile error.QKVCrossParallelLinearclass, both bias and weight parameters share the same weight loader function. Supporting weight_loader_v2 for bias parameters is out of scope of this PR, so the simplest solution is to implement a specialbias_weight_loaderforQKVCrossParallelLinearwhich is guaranteed to use weight_loader_v1.weight_loaderproperty with a note to begin supportingModel.load_weights.Testing
meta-llama/Llama-3.1-8B-Instructwith TP ∈ {1, 2}Qwen/Qwen1.5-MoE-A2.7Bwith TP ∈ {1, 2}