From cd9f5c0611f6e513bf94b1020b1062d73d1080b8 Mon Sep 17 00:00:00 2001 From: LI SHENGYONG <49200266+shenchuxiaofugui@users.noreply.github.com> Date: Sat, 29 Nov 2025 15:19:11 +0800 Subject: [PATCH] [bugfix] dep ineffective (#4416) ### What this PR does / why we need it? The expert mapping table and weights of the dynamic EPLB were not updated, causing the accuracy to be correct but not effective. This bug has now been fixed. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. Signed-off-by: shenchuxiaofugui <1311027364@qq.com> --- vllm_ascend/eplb/adaptor/vllm_adaptor.py | 6 +++--- vllm_ascend/ops/common_fused_moe.py | 2 +- vllm_ascend/torchair/ops/torchair_fused_moe.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vllm_ascend/eplb/adaptor/vllm_adaptor.py b/vllm_ascend/eplb/adaptor/vllm_adaptor.py index 7267630..d200fa6 100644 --- a/vllm_ascend/eplb/adaptor/vllm_adaptor.py +++ b/vllm_ascend/eplb/adaptor/vllm_adaptor.py @@ -194,15 +194,15 @@ class VllmEplbAdaptor(EplbAdaptor): json.dump(record, f, indent=4) def do_update_expert_map(self, layer_id, updated_expert_map): - self.expert_map_per_layer[layer_id] = updated_expert_map.clone() - self.expert_map_per_layer_cpu[layer_id] = updated_expert_map.clone() + self.expert_map_per_layer[layer_id].copy_(updated_expert_map) + self.expert_map_per_layer_cpu[layer_id].copy_(updated_expert_map) def do_update_expert_weight(self, layer_id, local_expert_to_replace, buffer_tensor_id): for expert_tensor, buffer_tensor in zip( self.expert_param_per_layer[layer_id][local_expert_to_replace], self.buffer_tensor_list[buffer_tensor_id]): - expert_tensor = buffer_tensor.clone() + expert_tensor.copy_(buffer_tensor) logger.debug(f"Expert tensor shape is :{expert_tensor.shape}") def do_update_log2phy_map(self, layer_id, updated_log2phy_map): diff --git a/vllm_ascend/ops/common_fused_moe.py b/vllm_ascend/ops/common_fused_moe.py index cc2a377..e33835b 100644 --- a/vllm_ascend/ops/common_fused_moe.py +++ b/vllm_ascend/ops/common_fused_moe.py @@ -271,7 +271,7 @@ class AscendFusedMoE(FusedMoE): return self.expert_map def get_log2phy_map(self): - return self.logical_to_physical_map + return self.log2phy def clear_moe_load(self): if self.moe_load is not None: diff --git a/vllm_ascend/torchair/ops/torchair_fused_moe.py b/vllm_ascend/torchair/ops/torchair_fused_moe.py index 18b9ceb..7a14ca5 100644 --- a/vllm_ascend/torchair/ops/torchair_fused_moe.py +++ b/vllm_ascend/torchair/ops/torchair_fused_moe.py @@ -1392,7 +1392,7 @@ class TorchairAscendFusedMoE(FusedMoE): return self.expert_map def get_log2phy_map(self): - return self.logical_to_physical_map + return self.log2phy def clear_moe_load(self): if self.moe_load is not None: