[Fix] Fix nan error for large scale ep (#12866)

This commit is contained in:
Baizhou Zhang
2025-11-11 14:44:57 -08:00
committed by GitHub
parent 4a2768a86b
commit 99e25805f5

View File

@@ -355,10 +355,14 @@ def _compute_logical_to_all_physical_map(
)
# Replace by the nearest physical expert
if nearest_expert != -1:
logical_to_all_physical_map[layer_id][logical_expert_id] = [
nearest_expert
]
mapped_physical_experts = logical_to_all_physical_map[layer_id][
logical_expert_id
]
if (
nearest_expert != -1
and nearest_expert not in mapped_physical_experts
):
mapped_physical_experts[0] = nearest_expert
logical_to_all_physical_map = _pad_nested_array(
logical_to_all_physical_map, pad_value=-1