hugging-apps/pruna-qwen-image-2-1-demo
Pruna-Qwen-Image-2.1 — few-step Qwen-Image-2.1
A DMD-distillation LoRA from Pruna that runs Qwen-Image-2.1 in 5 or 8 sampling steps with no classifier-free guidance, against the base model's 40 — the same pipeline, a fraction of the time. One model does both tasks, exactly as the base does: leave the reference slots empty for text-to-image, or attach one to three reference images for editing / composition / style transfer.
- 8-step adapter — recommended default, higher quality.
- 5-step adapter — fastest; the card notes visibly lower quality.
- Each adapter is trained on its own sigma schedule, so the app loads exactly one at a time and swaps it when you change the Steps setting.
The distillation recipe is reproduced exactly as published on the model card: the card's raw sigma nodes are passed as sigmas= on a scheduler rebuilt with use_dynamic_shifting=False, shift=1.0, shift_terminal=None (the stock Qwen-Image-2.1 scheduler ships use_dynamic_shifting=true and shift_terminal=0.02, which would shift the given sigmas a second time and stretch the terminal node), true_cfg_scale=1.0 with no negative prompt, LoRA strength 1.0, and condition images encoded at 1024-area (output_resolution=1024). Trained at 1K resolution, so the size menu offers 1024-area buckets for every aspect ratio.
Known limits (from the card). This is v0.1 — quality is below the 40-step base model; short or vague text-to-image prompts give weaker results (write detailed ones); other step counts, schedules, or CFG values are not supported.
Performance notes
- The 5-step and 8-step adapters are loaded together at startup (336 MB each) with distinct PEFT adapter names and switched with
set_adapters— only one is ever active on the transformer. - No VAE tiling: the pipeline encodes reference images through the same VAE, and tiled reference latents wreck edits (duplicated subjects, wrong scale).
Qwen3VLVisionPatchEmbed.forwardis rebound to an equivalent matmul: cuDNN has no usable bf16 Conv3d kernel for that shape and it costs ~30 s per reference image; the matmul is bitwise equal and ~0.8 ms.
License
The base model is released under the Qwen RESEARCH LICENSE AGREEMENT — Non-Commercial: research or evaluation purposes only. This distilled derivative and this demo inherit that restriction. Commercial use requires a separate license from Alibaba (model-business@notice.qwencloud.com).
Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.
