Repository navigation
Description
Loading Qwen/Qwen-Image-2.1 on a Colab A100-SXM4-40GB puts every component on whole-module offload, which pages the transformer, the text encoders and the VAE per step and turns VAE tiling on as a side effect. Group offload would have fit with about 8 GB to spare. It is never considered, because the pipeline load path hands the planner None for the companion split and both group checks are written to fail on None.
diffusion engine: diffusers (non-GGUF load (pipeline) requires diffusers)
diffusion.loaded: repo=Qwen/Qwen-Image-2.1 base=Qwen/Qwen-Image-2.1 device=cuda
offload=model tiling=True
reasons=companions exceed budget; whole-module offload of every component
The chain
kind == "pipeline", so_plan_memorytakes the branch atstudio/backend/core/inference/diffusion.py:6289and setscompanion_mib = Noneandtext_encoder_mib = None. The comment is explicit that this is deliberate: "No companion total on this branch (the whole repo IS the model), so there is no split to hand the planner either."_sum_requiredreturnsNoneif any argument isNone(diffusion_memory.py:718), sogroup_floorandgroup_floor_streamed_teare bothNone._group_fits()and_group_fits_streamed_te()are... is not None and ...(diffusion_memory.py:795), so both areFalseby construction, on any card of any size.- Resident placement is correctly declined, so the plan falls into the final
else:OFFLOAD_MODEL,"companions exceed budget"(diffusion_memory.py:860). tile = policy in (OFFLOAD_MODEL, OFFLOAD_SEQUENTIAL)(diffusion_memory.py:877), sovae_tilingcomes on with it.
refine_memory_plan_for_components runs afterwards against the real tensor sizes (diffusion.py:5513), but it only ever makes whole-module offload more granular when a component will not fit. It cannot walk back to group, and it does not touch vae_tiling.
What the split would have given
_FAMILY_BF16_GB["qwen-image-2.1"] already carries it at diffusion_auto_policy.py:54: transformer 14.2, text encoders 17.5, VAE 1.4 GB.
| MiB | vs budget | |
|---|---|---|
| resident (all three + 8192 headroom + 2048 overhead) | 44,140 | over, correctly declined |
| group floor (companions resident + headroom + overhead) | 28,264 | fits |
| group floor, text encoders streamed | 11,575 | fits |
Group offload is also faster than whole-module, so this costs speed and image quality at once.
The budget those rows are compared against is derived, not measured: safe_device_budget_mib is computed into plan.estimates but never logged, so on a 40 GB card with an idle GPU it works out to roughly 36,400 MiB after the 10% reserve. Logging the estimates alongside diffusion.loaded would take the guesswork out of the next report like this one.
Second, smaller bug in the same place
The reason string is wrong in this case. Nothing exceeded any budget, the size was simply unknown. Anyone reading companions exceed budget on a 40 GB card reasonably concludes their card is too small.
Environment
- Colab, A100-SXM4-40GB, CUDA, Python 3.13,
studio/setup.sh --localoffmain Qwen/Qwen-Image-2.1, diffusers engine, bf16 dense (diffusion.transformer_quant: skipped)- Code read at
upstream/main070f292
Independent of #11539: that PR shrinks the text encoder with a pre-cast fp8 checkpoint, which changes the numbers in the table above but not the control flow. With the split still None, group offload stays unreachable on a pipeline load however small the companions get.
What led here, not claimed as fixed by this
This came out of chasing visible streaking artifacts in Qwen-Image-2.1 output. Across 12 generations in one session tiling=True was set on every one, so the tiled decode has never actually been tested against on this path, and the artifact tracks image content rather than any setting. That makes it a plausible symptom of the placement decision above, not a proven one. The planner bug stands on its own terms either way.
Activity
Unsloth Studio: give the memory planner the companion split on a pipe…
Unsloth Studio: give the memory planner the companion split on a pipe…