-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
[Bugfix] Fix missing per_act_token parameter in compressed_tensors_moe #20509
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: Lu Fang <fanglu@fb.com>
👋 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.
Summary of Changes
Hello @luccafong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request delivers a crucial bugfix that resolves a serving issue impacting MoE layer operations, specifically within the cutlass_moe_fp8
function. It addresses a regression introduced by a prior refactor by making a key parameter optional and providing robust default value derivation, thereby restoring stability and preventing runtime failures in quantized MoE models.
Highlights
- Bugfix for MoE Layer: Addressed a critical 'maverick serving broken issue' that arose from a previous refactor (PR #19636). The issue was due to the
per_act_token
parameter being added tocutlass_moe_fp8
but not consistently passed by callers or given a default value, leading to failures. - Parameter Signature Update: Modified the
cutlass_moe_fp8
function signature invllm/model_executor/layers/fused_moe/cutlass_moe.py
to make theper_act_token
parameterOptional[bool]
and assign it a default value ofNone
. - Dynamic Parameter Derivation: Implemented logic within the
cutlass_moe_fp8
function to dynamically determine the value ofper_act_token
if it isNone
. This derivation is based on checking thenumel()
ofa1_scale
ora2_scale
, ensuring correct behavior even when the parameter is not explicitly provided by the caller.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 addresses a bug where the per_act_token
parameter was missing in some callers of cutlass_moe_fp8
. The fix makes the parameter optional and infers its value when not provided, preventing crashes. The implementation is robust and I've added suggestions to improve the code's documentation and readability.
@@ -322,7 +322,7 @@ def cutlass_moe_fp8( | |||
topk_ids: torch.Tensor, | |||
w1_scale: torch.Tensor, | |||
w2_scale: torch.Tensor, | |||
per_act_token: bool, | |||
per_act_token: Optional[bool] = None, |
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.
if per_act_token is None: | ||
per_act_token = a1_scale.numel() != 1 if a1_scale is not None else ( | ||
a2_scale.numel() != 1 if a2_scale is not None else 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.
The nested ternary expression can be difficult to read. Refactoring this into a more explicit if/elif/else
block would improve code clarity and maintainability.
if per_act_token is None:
if a1_scale is not None:
per_act_token = a1_scale.numel() != 1
elif a2_scale is not None:
per_act_token = a2_scale.numel() != 1
else:
per_act_token = False
@luccafong has imported this pull request. If you are a Meta employee, you can view this in D77824312. |
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.
We need to find a fundamental solution to guard the code
vllm-project#20509) Signed-off-by: Lu Fang <fanglu@fb.com>
vllm-project#20509) Signed-off-by: Lu Fang <fanglu@fb.com>
vllm-project#20509) Signed-off-by: Lu Fang <fanglu@fb.com> Signed-off-by: Patrick von Platen <patrick.v.platen@gmail.com>
Purpose
Fix maverick serving broken issue from refactor PR #19636.
per_act_token
was added in cutlass_moe_fp8 in PR #19636, but not passed in in some caller (e.g. CompressedTensorsW8A8Fp8MoECutlassMethod) and not given default value, causing failure,e.g.
vllm/vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py
Lines 934 to 940 in 7e90870
the per_act_token assignment was removed in PR #19636, so we add back the value if it is not passed (default None) to fix Maverick serving issue
Test Plan
Serving:
lm_eval: