fix: correct shard_ids for GDN in_proj_qkv under LoRA (Qwen3.5/3.6)#1711
Merged
Merged
Conversation
When --enable-lora is set, qwen3_5.py loads the GDN block's in_proj_qkv weight via stacked_params_mapping with shard_id=(0, 1, 2) (a single tuple), since exllamav3 quantizes q+k+v as one fused trellis for this layer regardless of the LoRA-enabled / combined-in_proj_qkvz split. _shard_ids_for_layer() only special-cased the LoRA-disabled combined 'in_proj_qkvz' prefix. For the standalone 'in_proj_qkv' prefix used in the LoRA-enabled path, it fell through to the generic fallback and returned [0, 1, 2] (three separate integer shard ids), which never matches the tuple key (0, 1, 2) actually populated by the weight loader, causing: ValueError: Missing EXL3 tensors for ...in_proj_qkv: suh[0], suh[1], suh[2], svh[0], svh[1], svh[2], trellis[0], trellis[1], trellis[2] This adds the missing branch, mirroring the tuple-shard convention already used for the qkvz case.
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.
Summary
When
--enable-lorais set for a Qwen3.5/3.6 (GDN hybrid Mamba/linear-attention) model quantized with EXL3, weight loading fails with:Root cause
aphrodite/model_executor/models/qwen3_5.py'sload_weights()has two branches depending on whether LoRA is enabled:exllamav3 quantizes this GDN block's q+k+v projection as a single fused trellis matrix (confirmed against
exllamav3/architecture/qwen3_5.py, which always defines separatein_proj_qkv/in_proj_zkeys, independent of any downstream LoRA split). So in both branches, the weight loader is called withshard_id=(0, 1, 2)— a single tuple — populatingparam.exl3_tensors[(0, 1, 2)].exl3.py'sExl3LinearMethod._shard_ids_for_layer()only special-cases the combinedin_proj_qkvzprefix (LoRA-disabled path):For the standalone
in_proj_qkvprefix (LoRA-enabled path), no branch matches, so it falls through to the generic fallback and returns[0, 1, 2]— three separate integer shard ids.process_weights_after_loading()then checks forexl3_tensors[0],exl3_tensors[1],exl3_tensors[2], none of which exist (only the tuple key(0, 1, 2)was ever populated), hence the "Missing EXL3 tensors" error.Fix
Add the missing branch, mirroring the tuple-shard convention already used for the
in_proj_qkvzcase:Test plan
Verified end-to-end on
Qwen3.6-27B-exl3-3.08bpw(TP=2, RTX 5070 ×2) with--enable-lora --max-lora-rank 64: weight loading now succeeds past this point (a separate, unrelated LoRA-device-detection issue was also found and fixed — see companion PR). Without this fix, loading fails deterministically at layer 0 as shown above.I also confirmed via
dphnAI/sonarissue/PR search that this specific combination (EXL3 + Qwen3.5/3.6 GDN hybrid + LoRA) had no prior reports.