-
Notifications
You must be signed in to change notification settings - Fork 744
[BugFix] Fix routed_scaling_factor_learnable not taking effect in cutlass backend apply_tp #7903
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
Changes from all commits
d3fec5d
4273e4e
22baa59
8ab69cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -446,7 +446,7 @@ def apply_tp( | |
| gate_out = gate_out.cast("float32") | ||
| if fc1_latent_proj is not None: | ||
| x = fc1_latent_proj(x) | ||
| gate_out, topk_weights, topk_idx = get_moe_scores( | ||
| gate_out, _, __ = get_moe_scores( | ||
| gate_out, | ||
| layer.n_group, | ||
| layer.topk_group, | ||
|
|
@@ -458,11 +458,6 @@ def apply_tp( | |
| use_fused_cast=use_fused, | ||
| ) | ||
|
|
||
| if layer.routed_scaling_factor_learnable: | ||
| safe_topk_indices = paddle.clip(topk_idx, min=0) | ||
| gathered_scales = F.embedding(safe_topk_indices, layer.per_expert_scale.unsqueeze(1)).squeeze(-1) | ||
| topk_weights = topk_weights * gathered_scales | ||
|
|
||
| ( | ||
| permute_input, | ||
| token_nums_per_expert, | ||
|
|
@@ -484,6 +479,12 @@ def apply_tp( | |
| self.moe_quant_type, | ||
| topk_only_mode=True, | ||
| ) | ||
|
|
||
| if layer.routed_scaling_factor_learnable: | ||
| safe_topk_indices = paddle.clip(topk_idx, min=0) | ||
| gathered_scales = F.embedding(safe_topk_indices, layer.per_expert_scale.unsqueeze(1)).squeeze(-1) | ||
| topk_weights = topk_weights * gathered_scales | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 建议 MoE 多后端同步检查 当前修复只涉及 |
||
|
|
||
| else: | ||
| gate_out = gate_out.cast("float32") | ||
| if fc1_latent_proj is not None: | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.