Repository navigation
[Fix] awq: Match modules_to_not_convert against a fused layer's shards - #52304
Conversation
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] A few things to fix before this can go in.
…on shard-name matches Addresses review: Qwen2.5-VL vision attn.qkv_proj is one tensor (not in its mapping), Whisper v_proj matching kv_proj must check K, Gemma 4 attention_k_eq_v layers have no v_proj.
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] A few things to fix before this can go in.
…ies, keep the fallback per name
|
ab600ec also fixes three things I found while reviewing this round:
Tests: |
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] A few things to fix before this can go in.
|
@BBuf Thanks, all four 02:28 findings reproduce on
Each of these comes from the same root cause: AWQ guesses from GPTQ already reads this from the checkpoint itself:
That would revert the Qwen2.5-VL and Gemma 4 model edits and keep the change in |
|
[BBuf Review Agent] @koladefaj BBuf, do you prefer switching AWQ to the checkpoint manifest in this PR or fixing the four cases in the current mapping? The manifest approach still needs to handle Gemma 4’s missing V explicitly, since the GPTQ resolver only returns dense when every expected shard is present and dense. |
|
[BBuf Review Agent] Let's fix the four cases in the current mapping in this PR (including reverting the module-boundary matching for ChatGLM) and leave the switch to the checkpoint manifest for a follow-up. |
… moe_wna16, declare Bailing's query_key_value, substring-match self-mapped layers
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] A few things to fix before this can go in.
…er Gemma 4 K=V shards for AutoRound too
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] One thing to fix before this can go in.
…checkpoint tensors
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] One thing to fix before this can go in.
|
/tag-and-rerun-ci |
|
✅ Approved by BBuf: CI runs on edf65e1. |
This comment has been minimized.
This comment has been minimized.
|
/tag-and-rerun-ci |
|
✅ Approved by BBuf: CI runs on dfdab18. |
|
The I merged the latest main (f4284f2, which includes #52843) here in 29d6a38. There were no conflicts, and the PR's diff against main is unchanged. Locally the AWQ and Quark unit tests and the GDN test pass (84 passed), and ruff format and check are clean. Could you |
|
/tag-and-rerun-ci |
|
✅ Approved by BBuf: CI runs on 29d6a38. |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
…onvert # Conflicts: # python/sglang/srt/layers/quantization/awq/awq.py
|
Hi @BBuf, thanks for retrying CI. The run on #52305 is in the same state. Base allows one run per author every 2 hours, so it may be best to tag that one about 2 hours after this. |
|
/tag-and-rerun-ci |
sglang-bot
left a comment
There was a problem hiding this comment.
[sglang-bot Review Agent] LGTM. Let's wait for CI.
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
Motivation
Fixes #52208. Same root cause in compressed-tensors: #52209, fixed in #52305.
is_layer_skipped_awqchecked eachmodules_to_not_convertentry as a plain substring of the layer prefix. AWQ checkpoints list the checkpoint's unfused shards (self_attn.q_proj,self_attn.k_proj,self_attn.v_proj), and none of them is a substring of SGLang's fusedself_attn.qkv_proj. SoQuantTrio/Qwen3.6-27B-AWQandQuantTrio/Qwen3.5-27B-AWQbuild their full-attentionqkv_projas AWQ while the checkpoint stores those shards dense:Incompatible dense checkpoint shard 'model.layers.11.qkv_proj.weight' cannot be loaded into quantized layer 'model.layers.11.qkv_proj'(the check from [Bug] Qwen3.5 hybrid (GDN) GPTQ checkpoint:linear_attn.in_proj_babuilt as quantized although the checkpoint storesin_proj_a/bas bf16 → 96× "not found in params_dict", thengptq_marlin_repackfails (size_n=96) #38854).not found in params_dictlines) and scored 0.00% on GSM8K.Modifications
is_layer_skipped_awqkeeps the substring match on the layer itself, and otherwise resolves the fused layer's shards withresolve_dynamic_fused_shards(the model'spacked_modules_mapping, then the shared fallback table) and matches each shard. All listed: unquantized. None: quantized. Some:ValueError, since that checkpoint cannot load correctly either way.AWQConfig,AWQCPUConfig,AWQMarlinConfig, NPU branch) are updated.AWQConfig.from_configandAWQMarlinConfig.from_configreadpacked_modules_mappingfrom the config dict (the loader already puts it there, as forfp8/gptq), so the model's own fused names reach the check, including the Marlin andMoeWNA16fallbacks that rebuild fromfull_config.TestIsLayerSkippedAWQintest_is_layer_skipped.py, using the real QuantTrio list. The new cases fail on448764da63and pass with this change.Notes for review:
linear_attn.in_proj_bmatchingin_proj_ba)._DYNAMIC_FUSED_SHARDS, so the GDNin_proj_qkvz/in_proj_baare expanded too, as GPTQ already does. For this checkpointin_proj_bahits the direct match andin_proj_qkvzhas no listed shard, so both behave as before.is_checkpoint_module_unquantized,get_dynamic_override); I left sharing a helper with it out of this PR.Accuracy Tests
RTX A40 (SM86), main
448764da63with and without this change applied,QuantTrio/Qwen3.6-27B-AWQ. GSM8K: sgl-eval 0.1.3, 200 examples,--num-threads 64 --max-tokens 4096 --temperature 0.7 --top-p 0.8 --chat-template-kwarg enable_thinking=false.--dtype bfloat16because the checkpoint is fp16 and fp16 GDN serving hits a separate crash at the first prefill (#31719, fix in #36289).ValueError: Incompatible dense checkpoint shard ...qkv_projEarlier runs on the same GPU: v0.5.23 scored 0.00%, and main with
self_attn.qkv_projappended tomodules_to_not_convertthrough--json-model-override-argsscored 98.00%. The only code change since those GPU runs is a comment rewrap.main
this PR
Speed Tests and Profiling
Not affected: the change runs once per layer at model construction.
Checklist
CI States
Latest PR Test (Base): ✅ Run #45949452126⚠️ Run #45949454042
Latest PR Test (Extra): ⊘ Skipped -- add the
run-ci-nv-extralabel to opt in.Latest PR Test (AMD ROCm 10):
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: