-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
[Model] Refactor JambaForCausalLM #21394
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]>
|
👋 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 refactors the Jamba model implementation, primarily by replacing the custom JambaMLP with the more generic LlamaMLP and by simplifying the weight loading logic in JambaForCausalLM to use the AutoWeightsLoader. These changes improve code clarity and maintainability. I've found two high-severity issues related to weight loading that could cause problems.
| ("qkv_proj", "q_proj", "q"), | ||
| ("qkv_proj", "k_proj", "k"), | ||
| ("qkv_proj", "v_proj", "v"), |
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.
The stacked_params_mapping entries for qkv_proj are missing leading dots1. This can cause ambiguous or incorrect weight name matching, as q_proj could match unrelated parameter names. Using .q_proj ensures matching a specific component, improving safety and explicitness. This inconsistency with gate_up_proj mappings and implementations in models like LlamaModel further emphasizes the need for correction.
Style Guide References
| ("qkv_proj", "q_proj", "q"), | |
| ("qkv_proj", "k_proj", "k"), | |
| ("qkv_proj", "v_proj", "v"), | |
| (".qkv_proj", ".q_proj", "q"), | |
| (".qkv_proj", ".k_proj", "k"), | |
| (".qkv_proj", ".v_proj", "v"), |
Footnotes
| return hidden_states.view(orig_shape) | ||
|
|
||
|
|
||
| class JambaMLP(JambaMoE): |
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.
Signed-off-by: Jee Jee Li <[email protected]>
| if num_experts > 1: | ||
| self.feed_forward = JambaMoE( | ||
| config, | ||
| quant_config=quant_config, | ||
| prefix=f"{prefix}.feed_forward", | ||
| ) | ||
| else: | ||
| self.feed_forward = JambaMLP( | ||
| config.hidden_size, | ||
| config.intermediate_size, | ||
| config.hidden_act, | ||
| quant_config=quant_config, | ||
| prefix=f"{prefix}.feed_forward", | ||
| ) |
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.
yeah this is cleaner
| (".gate_up_proj", ".gate_proj", 0), | ||
| (".gate_up_proj", ".up_proj", 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.
why do we have to handle these now? (the old code didn't mention these)
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.
These exist in the old version of the code https://github.com/vllm-project/vllm/blob/v0.5.4/vllm/model_executor/models/jamba.py#L857, this PR is just a revert
tlrmchlsmth
left a 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.
looks good, thanks - just a couple of nits
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: x22x22 <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Jinzhen Lin <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Noam Gat <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Paul Pak <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Diego-Castan <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
The main motivation is to standardize the model implementation and support BNB quantization
Test Plan
Test Result
(Optional) Documentation Update