Repository navigation
fix(studio): dequant 1-D GGUF norms on no-conversion load path - #12449
Souravrajvi0 wants to merge 6 commits into
Conversation
Pre-converted Qwen-Image-2.1 GGUFs skip checkpoint mapping but still ship packed norm weights; diffusers only dequantizes inside GGUFLinear layers. Run the same 1-D dequant step in the GGUF meta-loader shim used for every load.
cce4240 to
076383f
Compare
|
I checked this using norm weights from both reported Q8_0 and Q6_K files, the base loader reproduces the exact 4096 vs 8192 error and this fix resolves it |
|
Confirmed that pre-converted Qwen-Image-2.1 GGUFs skip the mapping function in diffusion.py, so their packed 1-D norms are never dequantized. Moving that step into the meta-loader shim covers it, and I will get this reviewed. |
|
@Imagineer99 Thanks for validating on Q8_0/Q6_K and for catching the flaky test — good call on Pushed a follow-up commit that builds the packed norm from a known finite |
Random packed bytes can decode to NaN and make torch.equal flaky.
|
@danielhanchen @Imagineer99 Quick status update:
From my side this is ready for review/merge whenever you have a moment. Thanks again for the thorough validation on Q8_0/Q6_K. |
|
tested at read the diff too and it looks right to me. it moves the existing 1-D dequant out of one small nit, not a blocker: the new call shares the |
|
This actually resolves the issue for me. |
Exercise the installed loader wrapper instead of the helper alone, so removing the wiring fails the test. Covers a BF16 and a Q8_0 vector, a packed matrix and a plain tensor that must pass through untouched, and a packed vector that also needs its leading axis restored. Simplify the state-dict loop and tighten the docstrings.
|
Pushed to this branch:
I also read the GGUF headers of the Q8_0, Q6_K and BF16 files from the repo in #12445: 297 tensors in diffusers names, 65 of them 1-D BF16, which matches the diagnosis. FLUX.1, FLUX.2-klein, Z-Image, Qwen-Image, Wan2.2 and SD3.5 GGUFs have no packed 1-D tensors, so the new step does nothing for them. |
|
Follow-up after re-checking against current #12775 (in v0.1.904-beta) added I confirmed it with a tiny What this PR would still add on top of My earlier comment here was written before I re-checked against the merged Thanks @Souravrajvi0 for the fix and the quick follow-ups. The diagnosis was right; the same step just landed through another PR first. |
|
Thanks for this, @Souravrajvi0, the fix was correct. Since then #12775 (shipped in v0.1.904-beta) added a post-load step that dequantizes every packed GGUF parameter outside |
Fixes #12445
Pre-converted Qwen-Image-2.1 GGUF repos (e.g. abenzerps/Qwen-Image-2.1-Uncensored-GGUF) already use diffusers tensor names, so _qwen_image_21_checkpoint_to_diffusers never runs and packed 1-D norm weights reach inference unchanged. diffusers only dequantizes inside GGUFLinear, which breaks on the first norm (4096 vs 8192).
This PR runs the same 1-D dequant step in the existing GGUF meta-loader shim (_install_gguf_dim_restore), alongside trimmed-dimension restore, and reuses the helper from the Qwen mapping path.
Test plan