mlboydaisuke's picture
RGBA-Image-2.1-Turbo Core AI port: bf16 + int8 DiT, text encoder, VAE x3 (debug locations stripped), host/, tokenizer/, card
c3bd985 verified
Raw History Blame Contribute Delete
4.1 kB
Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.
The model files in this repository were converted and re-authored into Apple Core AI .aimodel graphs
from the Qwen-Image-2.1-Turbo weights (Qwen/Qwen-Image-2.1-Turbo, revision
d65dbc9a7e8f6b5479e33dee6030eaab2a906509) and the Qwen-Image-2.1 weights (Qwen/Qwen-Image-2.1,
revision 790c92633540aa0cb11d9abf19eb46d861714758). They were changed as follows.
qi21t_dit_full_bf16_dyn_iofp32.aimodel — the diffusion transformer (from Qwen-Image-2.1-Turbo transformer/)
- Re-authored in plain PyTorch with the checkpoint's parameter names, then exported as one graph.
- Block-causal attention is computed as two scaled-dot-product-attention calls per block
(text tokens attend causally to text; image tokens attend to every token).
- Rotary position embeddings are applied as real-valued cos/sin pairs that the host supplies.
- The prefix key/value cache is removed: the text prefix is recomputed at every step.
- Weights and computation are bfloat16; every graph input and output is float32.
- Both sequence axes are dynamic (text 8-512 tokens, image 64-4096 tokens). Text-to-image only:
the graph has no condition-image input.
- The export-time debug locations (the conversion machine's source file paths) are stripped from
the graph file; the operations and the weights are untouched.
qi21t_dit_full_int8lin_dyn_iofp32.aimodel — the same diffusion transformer, with int8 Linear weights
- The same graph as above, from the same weights.
- The 232 Linear weight matrices are stored as int8 (symmetric, -127..127, one bfloat16 scale per
block of 32 input features) and dequantized to bfloat16 inside the graph. The normalization
weights and all computation stay bfloat16.
- The export-time debug locations (the conversion machine's source file paths) are stripped from
the graph file; the operations and the weights are untouched.
qi21_encoder_dynL_w16a32_ids_iofp32.aimodel — the text encoder (from Qwen-Image-2.1 text_encoder/)
- The text encoder of Qwen-Image-2.1-Turbo is byte-identical to that of Qwen-Image-2.1 (750 of 750
tensors). The graph is the one published in mlboydaisuke/RGBA-Image-2.1-CoreAI (revision
a9b5c9493571a8c4087dde0f4a191803feb0fd69), with its export-time debug locations (the conversion
machine's source file paths) stripped; the operations and the weights are untouched.
- Only the text path of the Qwen3-VL-8B encoder is kept. The vision tower, the language-model head
and the final RMSNorm are removed; the output is the residual stream after the last layer.
- Re-authored in plain PyTorch; the token embedding is inside the graph (int32 token ids in).
- Weights are stored in bfloat16 and all computation is float32; the output is float32.
- The sequence axis is dynamic (16-512 tokens).
qi21_vae_256_fp32.aimodel, qi21_vae_512_fp32.aimodel, qi21_vae_1024_fp32.aimodel — the VAE (from Qwen-Image-2.1 vae/)
- The float32 VAE weights of Qwen-Image-2.1. The vae/ of Qwen-Image-2.1-Turbo holds the same
weights rounded to bfloat16. The graphs are the ones published in
mlboydaisuke/RGBA-Image-2.1-CoreAI (revision a9b5c9493571a8c4087dde0f4a191803feb0fd69), with
their export-time debug locations (the conversion machine's source file paths) stripped; the
operations and the weights are untouched.
- Decoder only, one frame; the VAE encoder is not included.
- The latent un-normalisation (latents * std + mean) and the token-to-grid unpacking are inside
the graph.
- One graph per output size (256x256, 512x512, 1024x1024), float32.
Copied without changes from Qwen-Image-2.1-Turbo: LICENSE; config.json (= transformer/config.json);
tokenizer/ (= processor/ tokenizer.json, tokenizer_config.json, processor_config.json,
chat_template.jinja).
Added by the conversion: host/ (rotary tables and the sampler constants, computed from the model
definition and the checkpoint's sample_sigmas, and host_contract.md) and README.md.