Fix the global scale fix does not support EPLB and improve enabling condition (#10369)

This commit is contained in:
fzyzcjy
2025-09-14 01:07:47 -07:00
committed by GitHub
parent abea9250da
commit 2df532ef20
2 changed files with 8 additions and 10 deletions
@@ -504,14 +504,8 @@ class FusedMoE(torch.nn.Module):
param.data[:, :dim1, :dim2].copy_(loaded_weight)
return
# ModelOptNvFp4FusedMoEMethod uses max of global expert scaling factors for input scaling factor
load_global_experts = (
isinstance(self.quant_method, ModelOptNvFp4FusedMoEMethod)
and "input_scale" in weight_name
)
global_expert_location_metadata = get_global_expert_location_metadata()
if global_expert_location_metadata is None or load_global_experts:
if global_expert_location_metadata is None:
self._weight_loader_impl(
param=param,
loaded_weight=loaded_weight,
@@ -548,10 +542,12 @@ class FusedMoE(torch.nn.Module):
shard_id: str,
expert_id: int,
) -> None:
# WARN: This makes the `expert_id` mean "local" and "global" in different cases
if not getattr(param, "_sglang_require_global_experts", False):
expert_id = self._map_global_expert_id_to_local_expert_id(expert_id)
if expert_id == -1:
return
expert_id = self._map_global_expert_id_to_local_expert_id(expert_id)
if expert_id == -1:
return
self._weight_loader_impl(
param=param,
loaded_weight=loaded_weight,