mlboydaisuke's picture
RGBA-Image-2.1: Core AI port of Qwen-Image-2.1 (macOS 27, bf16 DiT + w16a32 encoder + fp32 RGBA VAE)
a9b5c94 verified
Raw
History Blame Contribute Delete
2.4 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 from the Qwen-Image-2.1 weights
(Qwen/Qwen-Image-2.1, revision 790c92633540aa0cb11d9abf19eb46d861714758) into Apple Core AI
.aimodel graphs. They were changed as follows.
qi21_dit_full_bf16_dyn_iofp32.aimodel — the diffusion transformer (from 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.
qi21_encoder_dynL_w16a32_ids_iofp32.aimodel — the text encoder (from text_encoder/)
- 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 vae/)
- 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: LICENSE; config.json (= transformer/config.json); tokenizer/ (= processor/
tokenizer.json, tokenizer_config.json, vocab.json, merges.txt, special_tokens_map.json,
added_tokens.json, chat_template.jinja).
Added by the conversion: host/ (rotary tables and sampler constants computed from the model
definition, and host_contract.md) and README.md.