Files
sglang/python
leavelet 2aca99d677 B300 NextN fp4: keep modelopt_fp4 for fp4-capable runners + generalize MTP exclude-remap
GLM-5.2-NVFP4's NextN (MTP) layer-78 routed experts are fp4, but deepseek_nextn unconditionally
dropped modelopt_fp4 for NextN (a DeepSeek-R1-FP4 assumption: its MTP is unquantized). Two fixes
(opus-designed, full back-compat matrix):

A) Drop fp4 for NextN only when the MoE runner can't consume it. Keep fp4 for flashinfer
   trtllm/trtllm_routed/cutedsl/cutlass (extends wxiwnd's helper to include our trtllm runner).
   R1-FP4/V3-FP4 (non-flashinfer-fp4 or unquantized MTP) still drop → bf16, no regression.

B) The NextN hf_to_sglang_mapper was hardcoded `model.layers.61 -> model.decoder` (R1's MTP idx).
   For GLM (MTP=layer 78) this never remapped the layer-78 self_attn/indexer exclude patterns to
   the internal model.decoder prefix → NextN attention wrongly quantized fp4 → crash. Worse, keeping
   the hardcoded 61 would mis-remap GLM's *real* layer 61. Fix: empty the class mapper and inject
   `model.layers.{num_hidden_layers} -> model.decoder` per-config in loader.py (gated on
   num_nextn_predict_layers; dataclasses.replace, no class mutation), generalizing to any MTP index.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 16:00:23 +00:00
..
2026-06-10 05:54:43 +08:00