Repository navigation
[diffusion] fix: load community ComfyUI-GGUF Qwen-Image-2.1 transformers - #42556
Merged
mickqian merged 5 commits intoOct 6, 2026
Merged
Conversation
niehen6174
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
JustinTong0323,
kevin-mii,
mickqian,
ping1jing2,
sogalin,
wisclmy0611,
yichiche and
zijiexia
as code owners
October 5, 2026 07:23
Collaborator
|
/tag-and-rerun-ci |
niehen6174
force-pushed
the
fix-qwen-image-21-community-gguf
branch
2 times, most recently
from
October 6, 2026 03:14
d458b5c to
9e6e46b
Compare
ComfyUI-GGUF exports of Qwen-Image-2.1 also quantize the plain nn.Linear layers outside the transformer blocks (modulation, timestep embedder, norm_out, proj_out), which have no packed-weight parameter to load into. Dequantize them to BF16 on load via gguf_dequantize_prefixes, matching the text-encoder GGUF path. Also skip the fused QKV view when the projections are GGUF-quantized: packed_qkv_weight read `.weight`, which GGUF layers do not register.
niehen6174
force-pushed
the
fix-qwen-image-21-community-gguf
branch
from
October 6, 2026 08:06
9e6e46b to
8081a68
Compare
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
Community ComfyUI-GGUF exports of Qwen-Image-2.1 (e.g.
abenzerps/Qwen-Image-2.1-Uncensored-GGUF) fail to load. Unlike the native-name exports validated earlier, they also quantize the plainnn.Linearlayers outside the blocks (modulation,time_text_embed,norm_out,proj_out), which have no packed-weight parameter to load into.Modifications
gguf_dequantize_prefixeson the DiT, the same mechanism the GGUF text-encoder path uses.packed_qkv_weightskips quantized projections instead of reading.weight, which GGUF layers do not have.main), plus a GGUF docs/cookbook validated-scope update.sglang generate --model-path Qwen/Qwen-Image-2.1 \ --component-weights-paths.transformer abenzerps/Qwen-Image-2.1-Uncensored-GGUF/qwen-image-2.1-UC-Q4_K_M.gguf \ --prompt "..." --save-outputAccuracy Tests
1x RTX 5090, default sampling params (1024x1024, 40 steps, guidance 1.0), seed 42, default auto memory policy.
qwen-image-2.1-Q8_0.gguf(baserevision, plain quantization)qwen-image-2.1-UC-Q4_K_M.ggufThe UC checkpoint is not a pure quantization. A tensor-level diff of its BF16 export against the official weights shows that every non-attention tensor is bit-identical. The attention
to_q/k/v/outweights equalbf16(W + 1.0 * B @ A)using the rank-16 LoRA shipped in the same repo, which explains the lower PSNR. Visually, the UC Q4_K_M output keeps the composition, subject, text rendering, and lighting of the official model on all three prompts tested:Speed Tests and Profiling
Same setup as above,
main+ this PR:As the GGUF guide notes, GGUF is a capacity option: the packed linears are dequantized each step and then run the native GEMM, so per-step latency is slightly higher.
Checklist
Not covered: TP, cache-dit, editing / RGBA with these files, other GGUF types (Q4_0/Q5_K_M/Q6_K), and the FP8 / INT8-ConvRot / NVFP4 safetensors in the same repo.
CI States
Latest PR Test (Base): ✅ Run #37465558588⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.