From 2b5b309133f60b84be69665e1633a6b50d7235d8 Mon Sep 17 00:00:00 2001 From: Clorist33 <117881833+Clorist33@users.noreply.github.com> Date: Tue, 16 Dec 2025 08:40:03 +0800 Subject: [PATCH] [Bugfix]Fix precision issues in moe_mlp (vllm-ascend v0.11.0-dev) (#5023) ### What this PR does / why we need it? Use group_list[0] to replace group_diff[0] in function "cumsum_group_list" (moe_mlp.py). The purpose is to modify it to the correct logic of converting cumsum to count. ### Does this PR introduce _any_ user-facing change? No Signed-off-by: tanqingshan (A) <50050625@china.huawei.com> Co-authored-by: tanqingshan (A) <50050625@china.huawei.com> --- vllm_ascend/ops/moe/moe_mlp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vllm_ascend/ops/moe/moe_mlp.py b/vllm_ascend/ops/moe/moe_mlp.py index 25dedd0..6e7b890 100644 --- a/vllm_ascend/ops/moe/moe_mlp.py +++ b/vllm_ascend/ops/moe/moe_mlp.py @@ -41,7 +41,7 @@ def cumsum_group_list(group_list: torch.Tensor, return group_list.cumsum(dim=0) if src_list_type == 0 and dst_list_type == 1: group_diff = torch.diff(group_list) - new_group = torch.cat([group_diff[0].unsqueeze(0), group_diff], dim=0) + new_group = torch.cat([group_list[0].unsqueeze(0), group_diff], dim=0) return new_group if src_list_type == 2 and dst_list_type == 0: experts = pad(group_list[:, 0], (1, 0))