Fix dpsk-r1-fp4 tp8 by reverting two commits (#13162 and #13341) (#13348)

Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com>
This commit is contained in:
Qiaolin Yu
2025-11-15 21:31:36 -08:00
committed by GitHub
co-authored by Kangyan-Zhou
parent f969664172
commit 78a4b446c6
5 changed files with 14 additions and 17 deletions
+9 -13
View File
@@ -284,17 +284,9 @@ class ExpertLocationMetadata:
# -------------------------------- usage ------------------------------------
def logical_to_all_physical(
self,
layer_id: int,
logical_expert_id: int,
require_global_experts: bool = False,
self, layer_id: int, logical_expert_id: int
) -> List[int]:
# Use CPU copy to avoid GPU→CPU sync on every call, which is expensive in update weights scenario
if require_global_experts:
num_physical_experts = self.logical_to_all_physical_map_cpu[layer_id].shape[
-1
]
return list(torch.arange(0, num_physical_experts))
return [
physical_expert_id
for physical_expert_id in self.logical_to_all_physical_map_cpu[
@@ -363,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