Repository navigation
qwen_image: Qwen-Image-2.1 text to image on MLX (draft proposal, non-lane family, stacked on #384) - #393
Closed
drowzeys wants to merge 4 commits into
Closed
qwen_image: Qwen-Image-2.1 text to image on MLX (draft proposal, non-lane family, stacked on #384)#393drowzeys wants to merge 4 commits into
drowzeys wants to merge 4 commits into
Conversation
A non-lane family: the 33B diffusion transformer, packed sequence, schedules and joint denoise loop, adapter merging in float32, int8 MLP / QKV / attention output kernels on the M5 tensor units, and the video decoder. The transformer and the float32 video decode equal minimax-h3-mlx's on real inputs. The text encoder, audio decoder and MP4 writer are not ported; tools/h3_generate_dev.py borrows minimax-h3-mlx's. docs/recipes/minimax-h3.md has the measurements. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj
The sampler takes encoded keyframe rows, noises them to 0.999 from the request generator before the video and audio noise (the reference's draw order), holds them for every step and steps only the generated rows. The tool's --first-frame encodes the image with minimax-h3-mlx's VAE encoder and vision tower. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj
… int8 projections Text to image on the H3 int8 tensor-unit kernels. The text prefix is run once per prompt. The prompt encoder is borrowed from mflux by the development tool. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj
Owner
|
Thank you, @drowzeys. Keeping the text prefix's keys and values across every denoising step, with a test that the stored prefix equals a joint block-causal pass, is a nice touch, and you were candid about the bf16 gap to mflux. We're closing it for the same reasons as #384. Qwen-Image denoises rather than decodes, so there is no lane round for it, its int8 kernels are on by default and trade precision, and it is an MLX family, while the Python engine is frozen (#286) and the Zig engine drives Metal directly. It also stands on #384, which we're closing too. Thanks for proposing it in the open. Your GLM-5.3 work in #159 is the kind we want, and it waits for GLM on the Zig engine. |
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.
Draft, as a proposal, stacked on #384. Like the H3 draft, this is a model family outside the lane rules, and CONTRIBUTING asks for an issue first. I am opening it as a draft so the code and measurements sit beside #384 for the same conversation; close it if image generation does not belong in TensorFold. Only the last two commits are new here; the first two are #384's, because this family runs on the int8 kernels that one adds.
Thank you first: this stands on your family and kernel structure. The model code is adapted from mflux (Filip Strand and contributors), whose qwen21 model follows Qwen and Hugging Face's diffusers pipeline.
THIRD_PARTY_NOTICES.mdrecords both.What it is
Qwen-Image-2.1 is a text-to-image model: a 7B single-stream transformer (32 blocks, hidden 4,096, 32 heads of 128, SwiGLU width 12,288) denoises 64-channel latents, and a convolutional decoder turns them into pixels. This adds
families/qwen_image:docs/recipes/qwen-image-2.1.mdwith the measurements, and rows in the family and recipe tables.No new kernel. The fused QKV kernel rotates channel
cwithc + 64and this model rotates neighbours, so the q and k rows are reordered within each head to [even, odd] before quantizing; the dot product between them does not see a shared channel order. A test checks that.Where it does not fit the rules
load, setsLANES = False, andtensorfold servedoes not route it. Nothing in the lane engine, the server or any existing family is touched.--no-int8keeps bfloat16). Same seed and prompt against mflux: 32.7 dB in bfloat16, 30.4 dB in int8.It is not complete
tools/qwen_image_generate_dev.pyborrows mflux's, so the tool needs mflux on the path.tensorfold generate, no checkpoint detection throughfamilies.detect, no resident engine.Receipt
Environment. TensorFold 0.6.5 + h3: MiniMax H3 video and audio generation on MLX (draft proposal, non-lane family) #384 + these commits, MLX 0.32.3, Mac Studio M5 Ultra 256 GB, macOS 27.0.1. Checkpoint
Qwen/Qwen-Image-2.1. Reference: mfluxadd5164. Adapter:Viggle/Qwen-Image-2.1-viggle-turbov0.3, rank 256.Exactness.
bench_concurrent.pyandtoken_shado not apply.tools/qwen_image_parity_dev.pyprints the figures in point 2.Speed, one prompt (94 text tokens), 1344x768 (4,032 image tokens), seed 42, one run each:
add5164, bfloat16In bfloat16 this is slower per step than mflux, which compiles its step. The gain is the int8 kernels and the adapter.
Prompt speed. Not applicable; no prefill, kernel, engine or server path of an existing family is changed.
Tests. Host suite on the M5 Ultra: 4997 passed, 609 skipped, 14 failed. The same 14 fail on untouched 0.6.5 in this environment (listed in h3: MiniMax H3 video and audio generation on MLX (draft proposal, non-lane family) #384). New:
tests/test_qwen_image_family.py, 15 tests on small random models, including that the stored text prefix equals a joint block-causal pass.What I did not run. Any Mac other than an M5 Ultra. Other image sizes, more than one prompt and seed, text rendering. CUDA: the family has no CUDA engine.
Notes for landing
A packaged install that chains this into MiniMax H3 (text to image to video) is at https://github.com/drowzeys/keys-Mac-TensorFold-Studio.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PrUiTH1dGwnVKrpFLkoGHj