Repository navigation
Description
Environment
Where are you using Unsloth?
- Unsloth desktop application
- Unsloth web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Operating system and version: Windows 11 Pro, build 26300 (10.0.26300)
GPU model(s) and accelerator backend: NVIDIA GeForce RTX 4080 SUPER (16 GB VRAM), CUDA
Versions:
- Unsloth Studio (Desktop): 0.1.900-beta
- Bundled backend venv: Python 3.13, torch, diffusers (shipped with Studio)
What happened?
Steps to reproduce:
- In Unsloth Studio, download
abenzerps/Qwen-Image-2.1-Uncensored-GGUF(Q8_0; the issue also reproduces with Q6_K from the same repo). - Let Studio fetch the companion repos (
unsloth/Qwen-Image-2.1text encoder + VAE, FP8 text encoder) — these download fine. - Load the model — load succeeds (
diffusion.loaded: repo=abenzerps/Qwen-Image-2.1-Uncensored-GGUF base=Qwen/Qwen-Image-2.1 device=cuda offload=group ...). - Generate any image.
Expected behavior: Image generation runs.
Actual behavior: Every generation fails with:
RuntimeError: The size of tensor a (4096) must match the size of tensor b (8192) at non-singleton dimension 2
Traceback ends in:
diffusers\pipelines\qwenimage21\pipeline_qwenimage21.py (line ~772)
studio\backend\core\inference\diffusion_qwenimage21.py (line ~344)
diffusers\models\transformers\transformer_qwenimage21.py (lines ~185/197)
diffusers\quantizers\gguf\utils.py (line ~578, in __torch_function__)
Model and operation involved: abenzerps/Qwen-Image-2.1-Uncensored-GGUF (qwen-image-2.1-UC-Q8_0.gguf, SHA-256-verified complete download; also qwen-image-2.1-UC-Q6_K.gguf) — diffusion GGUF inference.
Root cause (investigated)
This is not a corrupt download and not quant-specific (Q8_0 and Q6_K fail identically), and it is unrelated to the repo uploader's earlier Q8_0 RMSNorm advisory.
This GGUF stores 65 one-dimensional norm weights (txt_in.text_norm + 64 attention norms) as BF16-packed GGUF tensors (e.g. 4096 bf16 elements = 8192 raw bytes — exactly the 4096-vs-8192 mismatch). diffusers only dequantizes inside GGUFLinear layers, so 1-D norms must be dequantized at load time.
Studio already has the correct fix, but it never runs for this file:
_qwen_image_21_checkpoint_to_diffusers()contains the 1-D dequant logic.- However, diffusers/Studio skip the checkpoint conversion path when the GGUF's tensor names already match diffusers naming — which is the case for this repo (verified: all 297 tensors match
QwenImage21Transformer2DModelnaming exactly, and the mapping function is never invoked). - Result: the 1-D norm weights reach the forward pass as raw packed byte tensors and crash on the first norm.
Suggested fix: run the 1-D norm dequant also in the no-conversion GGUF load path, e.g. alongside _install_gguf_dim_restore / _restore_gguf_trimmed_dims in studio/backend/core/inference/diffusion.py.
Verified local workaround
Appending this to _restore_gguf_trimmed_dims (which runs for every GGUF load, including the no-conversion path) fixes generation for both Q8_0 and Q6_K:
# Dequant 1-D norm weights for pre-converted Qwen-Image-2.1 GGUFs.
for name, have in list(state_dict.items()):
quant_shape = getattr(have, "quant_shape", None)
if quant_shape is not None and len(quant_shape) == 1:
from diffusers.quantizers.gguf.utils import dequantize_gguf_tensor
state_dict[name] = dequantize_gguf_tensor(have)With this patch, a full QwenImage21Transformer2DModel forward pass on CUDA succeeds (Q6_K: peak VRAM 5.98 GiB; Q8_0: 7.55 GiB; output finite). Before the patch, txt_in.text_norm forward crashes with the exact error above.
Logs
From %USERPROFILE%\.unsloth\studio\logs\backend-backend-*.log:
"event": "diffusion.loaded: repo=abenzerps/Qwen-Image-2.1-Uncensored-GGUF base=Qwen/Qwen-Image-2.1 device=cuda offload=group resolved=[transformer_quant=off(auto) text_encoder_quant=fp8(auto) cpu_offload=True(auto)] estimates={'safe_device_budget_mib': 13013, 'model_dense_mib': 24966, 'text_encoder_dense_mib': 16721}"
"event": "diffusion.generate_failed: The size of tensor a (4096) must match the size of tensor b (8192) at non-singleton dimension 2"
Additional context
Possibly related secondary issue: during the first FP8 text-encoder pre-quantization, the backend hit Windows commit-limit exhaustion (diffusion.te_prequant: fp8:text_encoder:repo failed: Il file di paging è troppo piccolo per essere completato. (os error 1455)) on a machine with 32 GB RAM + 42 GB pagefile. It succeeded on a later run, but the pre-quantization step may need more conservative peak-memory handling on Windows.
Activity
Souravrajvi0 commentedon Oct 1, 2026
Thanks for the thorough write-up — the no-conversion load path skipping
_qwen_image_21_checkpoint_to_diffusersmatches what we see in code.Opened a fix that dequantizes 1-D
GGUFParameternorms in the same meta-loader shim as_restore_gguf_trimmed_dims(so pre-converted Qwen-Image-2.1 GGUFs are covered), and reuses that helper from the mapping function: #12449Imagineer99 commentedon Oct 1, 2026
Confirmed the same error with both Q8_0 and Q6_K on a Colab A100, dequantizing the 1-D norm weights at load time fixes it and both models generate images successfully. FP8 memory error looks like a separate issue.
danielhanchen commentedon Oct 8, 2026
Thanks for the detailed root cause, this is fixed in the latest Unsloth Desktop release, v0.1.904-beta.
#12775 added a post-load step that dequantizes every packed GGUF parameter outside
GGUFLinearafter each GGUFfrom_single_fileload, so it also covers pre-converted Qwen-Image-2.1 GGUFs that skip the checkpoint conversion path.I checked it with
abenzerps/Qwen-Image-2.1-Uncensored-GGUF(qwen-image-2.1-UC-Q6_K.gguf):The size of tensor a (4096) must match the size of tensor b (8192)Only the small norm weights are dequantized; the 229 quantized linear weights stay quantized.
Please update Unsloth Desktop to v0.1.904-beta (the in-app updater, or download it from https://github.com/unslothai/unsloth/releases/latest). If generation still fails after the update, please post the new backend log here.
The Windows paging-file error during FP8 text encoder pre-quantization is a separate problem, so a new issue for that one would be great.
danielhanchen commentedon Oct 8, 2026
Fixed! Pre-converted Qwen-Image-2.1 GGUFs skip the checkpoint conversion, so their BF16 norm weights stayed packed and the first norm failed with 4096 vs 8192. #12775 now dequantizes every packed GGUF weight outside the linear layers right after load, and it ships in v0.1.904-beta.
To update: Unsloth Desktop will have an update banner. For Studio, use
unsloth studio updateFor Docker, useexec <container> unsloth-studio-updateReopen if it still happens.WolCarlos commentedon Oct 14, 2026
Confirmed fixed on the original reporter's machine 👍
After updating to v0.1.904-beta, on the same setup from the issue (Windows 11 Pro 26300, RTX 4080 SUPER 16 GB,
abenzerps/Qwen-Image-2.1-Uncensored-GGUFQ8_0):unsloth/Qwen-Image-2.1-FP8(~9 GB one-time download) instead of quantizing the dense encoder locallydiffusion.generated: engine=diffusers workflow=txt2img images=1 size=1024x576 steps=25— HTTP 200, ~35 s, correct image out4096 vs 8192tensor errorThanks for the quick fix — closing.