feat(examples): Qwen-Image 20B MMDiT text-to-image on Trainium - #85
Open
ymwangg wants to merge 1 commit into
Open
feat(examples): Qwen-Image 20B MMDiT text-to-image on Trainium#85ymwangg wants to merge 1 commit into
ymwangg wants to merge 1 commit into
Conversation
Add a device-only, TP-mandatory Qwen-Image text-to-image pipeline (MMDiT denoiser + Qwen2.5 text-encoder + VAE decoder), with fused on-device CFG + FlowMatchEuler sampling and an end-to-end demo.sh. Includes the RoPE interleave-scatter perf fix (denoiser 14.1s -> 0.30s/step), 512px default, in-memory weights, and device-wrapper refactor onto a _DeviceModule base.
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.
Summary
Adds a device-only, TP-mandatory Qwen-Image 20B MMDiT text-to-image pipeline to
examples/models/qwen_image/. The full pipeline runs on trn2 (TP=4):Produces correct 512px images. End-to-end
demo.shreuses the compile cache, runs CPU correctness tests, then generates viatorchrun.Notable details
(2i, 2i+1)pair convention, not qwen3's(i, i+half)split.latents_stdas its reciprocal (latents / std_recip); dividing by raw std instead is off by ~std².Test plan
uv run pytest examples/models/qwen_image/tests/QWEN_IMAGE_TP_DEVICE_TEST=1 uv run pytest tests/test_tp_device.pySee
examples/models/qwen_image/README.mdfor full run instructions and the durable lessons/limits.