Repository navigation
[k3] declare packed_modules_mapping on KimiK3ForConditionalGeneration - #36211
Merged
Merged
Conversation
KimiK3's runtime fuses checkpoint shards into merged modules (qkv_conv1d, fused_qkvg_proj, fused_qkvbfg_a_proj, fused_fg_b_proj, ...), but the model class declares no packed_modules_mapping, so quantization configs cannot match per-shard exclude_modules against the fused runtime prefixes. Concretely, NVIDIA's Kimi-K3-NVFP4 hf_quant_config.json excludes *self_attn.q_conv1d* / *self_attn.k_conv1d* / *self_attn.v_conv1d*; today the fused qkv_conv1d module is only excluded because the *v_conv1d* pattern happens to substring-match the fused name 'qkv_conv1d' -- the q_ and k_ patterns match nothing. Any checkpoint whose excludes do not get that one-character accident quantizes modules the producer excluded. Declare the mapping (same shape as the 80+ other model classes), so ModelOptFp4Config and friends resolve fused prefixes to their shard names structurally.
sshleifer
approved these changes
Aug 24, 2026
ispobock
approved these changes
Aug 28, 2026
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
We need this packed modules mapping for reading excluded modules from quantization configs. This is primarily a concern for nvfp4 weights, such as NVIDIA's checkpoint here. Note that this checkpoint is OK because of wildcards but a more intentional/systematic approach is desired.
The following is AI's slightly-verbose rationale:
Modifications
Added packed modules mapping to K3
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #33060683597
Latest PR Test (Extra): ❌ Run #33060683273
Latest PR Test (AMD ROCm 7.2): ❌ Run #33060683637