[ModelOpt][PP] Keep BF16 shared experts out of the NVFP4 fusion so TP1 pipeline stages can load (#40628)

This commit is contained in:
YAMY
2026-09-21 21:45:58 -07:00
committed by GitHub
parent 2032f3a071
commit 9b59fc5db5
2 changed files with 31 additions and 0 deletions
@@ -1497,6 +1497,15 @@ class ModelOptFp4Config(ModelOptQuantConfig):
def get_min_capability(cls) -> int:
return 80
def can_fuse_shared_expert(self) -> bool:
# A shared-expert body kept BF16 via exclude_modules cannot share the packed
# FP4 FusedMoE buffers. The shared_expert_gate is a separate linear (kept
# BF16 by e.g. Qwen3-Next NVFP4 checkpoints) and must not veto fusion.
return not any(
"shared_expert" in name and "shared_expert_gate" not in name
for name in self.exclude_modules
)
@staticmethod
def common_group_size(cfg: dict) -> int:
"""Return the unique group_size across the config; raise if missing/mismatched."""