Conversation
divyvasal
requested review from
Alisehen,
AniZpZ,
BBuf,
Edwardf0t1,
FlamingoPg,
HaiShaw,
OrangeRedeng,
b8zhong,
ch-wan and
mmangkad
as code owners
September 10, 2026 03:15
ModelOpt writes some vision-language checkpoints with the decoder nested under
`model.language_model.*` while sglang builds it as `model.*`. The strip in
`apply_weight_name_mapper` only fires for a *leading* `language_model.`, so an
interior one never matches: every layer the checkpoint keeps in BF16 is built as
an FP4 module and the load dies on a shape mismatch.
Seen on nvidia/GLM-5.3-Flash-NVFP4, whose exclusion list is written as
`model.language_model.layers.N.self_attn*`, `...mlp.gate` and
`...mlp.shared_experts*`. With TP8 on 8xB200 the first mismatch is:
AssertionError: target.shape=torch.Size([4096, 256]),
loaded_weight.shape=torch.Size([4096, 512])
the FP4-packed parameter against the BF16 tensor the checkpoint actually ships.
Expand the interior form alongside the existing leading-strip, at the same point
and in the same shape. Names without the segment are untouched, and the
expansion is exact rather than a wildcard, so it cannot widen a match: layer 10's
gate stays excluded while layer 11's is not.
This is the decoder half of sgl-project#36596. sgl-project#36761 covers the fused-module and
`model.`-prefixed vision-tower halves on the prefix side; the two are orthogonal
and touch different functions. On this checkpoint neither alone is sufficient:
sgl-project#36761 fixes `visual.*`, this fixes `model.layers.*`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
divyvasal
force-pushed
the
fix/modelopt-exclude-interior-language-model
branch
from
September 10, 2026 03:21
fc01082 to
9da1cd5
Compare
Author
|
Closing as redundant — superseded by #38621, which merged on 2026-09-09 and which I missed when I opened this. #38621 handles the same hf_to_sglang_mapper = WeightsMapper(orig_to_new_substr={
"model.language_model.": "model.", "model.visual": "visual"})Confirmed on our side: with #38621 applied to the 2026-09-03 Thanks to the author of #38621. Sorry for the duplicate noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Follow-up to #36596. #36761 fixes the fused-module and
model.-prefixed vision-tower halves; this fixes the third naming form, which neither the shipped matcher nor that PR handles: exclusions nested undermodel.language_model.*.apply_weight_name_mapperstripslanguage_model.only when it is the leading segment. ModelOpt writes some vision-language checkpoints with the decoder nested one level in —model.language_model.layers.N.*— while sglang builds it asmodel.layers.N.*. The strip never fires, every layer the checkpoint keeps in BF16 is built as an FP4 module, and the load dies on a packed-versus-unpacked shape mismatch.Hit on
nvidia/GLM-5.3-Flash-NVFP4(the official NVIDIA checkpoint; #36596 was filed against LibertAIDAI's, which is spelled differently) at TP8 on 8xB200, FlashInfer 0.6.17:the FP4-packed parameter against the BF16 tensor the checkpoint actually ships.
Its exclusion list uses this form throughout —
model.language_model.layers.N.self_attn*,...mlp.gate,...mlp.shared_experts*— so on this checkpoint the two PRs are both required and neither is sufficient. Measured against that exclusion list with the matcher's shipped behaviour, #36761's logic, and this change:visual.blocks.10.attn.projmodel.layers.0.self_attn.kv_b_projmodel.layers.10.mlp.gatemodel.layers.10.mlp.shared_experts.gate_up_projModifications
python/sglang/srt/layers/quantization/modelopt_quant.py: inapply_weight_name_mapper, expandmodel.language_model.<rest>tomodel.<rest>alongside the existing leading-segment strip. Same place, same shape, and the expansion is exact rather than a wildcard, so it cannot widen a match.Accuracy
No numerical change. This only affects which modules are built quantized; it restores the checkpoint's own intent, which is that these layers stay BF16.
Checklist
test/registered/unit/layers/quantization/test_modelopt_nvfp4.py: the interior form matches, the checkpoint's own spelling still matches, a neighbouring layer index does not match, the leading strip is unchanged, and names without the segment are left untouched.hf_quant_config.jsonfromnvidia/GLM-5.3-Flash-NVFP4, in the sglang image, on 8xB200.CI States
Latest PR Test (Base): ❌ Run #34433045876
Latest PR Test (Extra): ❌ Run #34433045790
Latest PR Test (AMD ROCm 10): ❌ Run #34433045968