Repository navigation
[diffusion] model: support qwen-image-2.1 - #39983
Merged
mickqian merged 69 commits intoSep 20, 2026
Merged
Conversation
4 of 5 tasks
[diffusion] Optimize Qwen-Image 2.1 DiT and VAE kernels
3 of 4 tasks
3 of 4 tasks
3 of 4 tasks
5 tasks done
This was referenced Sep 24, 2026
13 tasks done
This was referenced Sep 29, 2026
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
Add native Qwen-Image 2.1 text-to-image generation and editing, including multiple reference images and RGBA input/output. SGLang owns the model components and preserves the checkpoint's Transformers 4.57.3 conditioning semantics.
Modifications
qwen_image21_t2i_tp2for the two-GPU E2E suite (temporarily disabled until the checkpoint is accessible to fork PR CI): 1024×1024 PNG, 40 steps, CFG 1, seed 42, two consecutive requests, model API and pinned image-consistency checks. Reference image (merged): ci-data-diffusion #7.Speed tests
Incremental Q/K normalization on one B200 (resident, FlashAttention, eager, 1024×1024, 40 steps, seed 42, CFG 1; four fresh starts in new/base/base/new order, two warmups per start) reduced median generation latency from 3.114 to 2.828 s (9.17%; 10 samples per variant) and editing from 3.742 to 3.450 s (7.81%; six samples per variant).
The subsequent scale-only LayerNorm change reduced median generation latency from 2.831 to 2.748 s (2.92%) and editing from 3.436 to 3.358 s (2.26%), with identical corresponding output pixels. These measurements predate the latest conditioning correction and apply only to the tested commits/workload; they are not a new accuracy baseline.
On one RTX PRO 6000 Blackwell Server Edition (96GB, SM120), corrected implementation
1eab5de5990passed 1024×1024/40-step HTTP generation, editing, transparent generation, and repeated transparent-input editing with Torch SDPA. Resident generation/edit medians were 8.23/9.85 s with 40.1 GiB peak device memory; DiT offload measured 10.28/10.66 s and 26.1 GiB. All 13 corresponding RGBA outputs matched exactly across placements; 156 kernel/model tests passed (21 skipped). Multi-GPU and NVFP4 recipes on this GPU remain unverified.Checklist
Regression validation on two H200 GPUs at
2d7c5365fb0: all 41 focused vision/Qwen tests passed, including exact CPU/GPU RoPE checks and the real component-offload path. Two consecutive H3 ref2va requests produced six sampled frames identical pixel-for-pixel to main9784d5f979c9; the previous PR head differed on every sampled frame. Both main and the corrected branch remain below the H100 reference-image SSIM threshold on this H200 environment, so this comparison establishes parity with main rather than an upstream H100 consistency pass. Reference images and thresholds are unchanged.The TP2 E2E case is temporarily disabled in
6078c9049b3after upstream CI returned HTTP 401 during checkpoint loading. The case configuration, scheduling estimate, and pinned reference image are retained for re-enabling it when the checkpoint is accessible to fork PR CI. Earlier isolated B200 TP2 consistency tests passed.CI States
Latest PR Test (Base): ✅ Run #35448201646
Latest PR Test (Extra): ❌ Run #35448201426
Latest PR Test (AMD ROCm 10): ❌ Run #35448201642