card: measured 256/512/1024 numbers
Browse files
README.md
CHANGED
|
@@ -28,9 +28,20 @@ and caption axes are dynamic, at a ~5–9 % cost over static shapes.
|
|
| 28 |
|
| 29 |
| file | role | size |
|
| 30 |
| --- | --- | --- |
|
| 31 |
-
| `zimage_dit_...
|
| 32 |
-
| `
|
| 33 |
| `zimage_vae_{256,512,1024}_fp32.aimodel` | 16ch VAE decoder (per-size) | 189 MB each |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
**bf16, not int8.** On this compute-bound graph weight-only int8 is *slower* than bf16
|
| 36 |
(2.35 vs 0.89 s/forward at 512²) because it dequantizes back to 16-bit and runs the same
|
|
@@ -41,9 +52,9 @@ the port numerically near the fp32 reference.
|
|
| 41 |
|
| 42 |
| | s/forward | denoise (8 steps, CFG = 16 forwards) | PSNR |
|
| 43 |
| --- | --- | --- | --- |
|
| 44 |
-
| 256² | 0.
|
| 45 |
-
| 512² |
|
| 46 |
-
| 1024² | 4.
|
| 47 |
|
| 48 |
Per-step velocity correlation vs the reference is ≥ 0.9997 at every step and both CFG
|
| 49 |
branches. PSNR is not comparable across prompts: a texture-heavy oil-painting prompt scores
|
|
@@ -51,10 +62,15 @@ branches. PSNR is not comparable across prompts: a texture-heavy oil-painting pr
|
|
| 51 |
|
| 52 |
## Usage
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
[`
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
```python
|
| 60 |
# per step, for cond and uncond:
|
|
|
|
| 28 |
|
| 29 |
| file | role | size |
|
| 30 |
| --- | --- | --- |
|
| 31 |
+
| `zimage_dit_..._dyncap_dynimg_iofp32.aimodel` | the DiT — any resolution, any prompt length | 11 GB |
|
| 32 |
+
| `zimage_encoder_seq64_full_bf16_ids_iofp32.aimodel` | Qwen3 encoder → **penultimate** hidden; `embed_tokens` is *inside* the graph | 7.3 GB |
|
| 33 |
| `zimage_vae_{256,512,1024}_fp32.aimodel` | 16ch VAE decoder (per-size) | 189 MB each |
|
| 34 |
+
| `glue/` | RoPE tables + a `t_embedder` graph | 2.4 MB |
|
| 35 |
+
| `tokenizer/` | Qwen2 BPE | 15 MB |
|
| 36 |
+
|
| 37 |
+
**Weights are bf16; the graph boundaries are fp32** (`--io-fp32`). That is not a preference:
|
| 38 |
+
a Swift host cannot fill or read a bfloat16 `NDArray`, and bf16 is the only dtype this DiT is
|
| 39 |
+
numerically safe in. Casting at the boundary costs ~15 % per forward and *improves* fidelity
|
| 40 |
+
(PSNR 39.5 → 42.6 dB) because nothing rounds on the way in.
|
| 41 |
+
|
| 42 |
+
The `glue/` is what keeps a host from re-implementing the reference: `RopeEmbedder` is a
|
| 43 |
+
per-axis table lookup, so three tables reproduce it exactly at any resolution and prompt
|
| 44 |
+
length, and the timestep MLP ships as a 2 MB graph.
|
| 45 |
|
| 46 |
**bf16, not int8.** On this compute-bound graph weight-only int8 is *slower* than bf16
|
| 47 |
(2.35 vs 0.89 s/forward at 512²) because it dequantizes back to 16-bit and runs the same
|
|
|
|
| 52 |
|
| 53 |
| | s/forward | denoise (8 steps, CFG = 16 forwards) | PSNR |
|
| 54 |
| --- | --- | --- | --- |
|
| 55 |
+
| 256² | 0.36 | 5.8 s | 35.6 dB |
|
| 56 |
+
| 512² | 1.12 | 17.9 s | **42.6 dB** |
|
| 57 |
+
| 1024² | 4.36 | 69.7 s | 42.3 dB |
|
| 58 |
|
| 59 |
Per-step velocity correlation vs the reference is ≥ 0.9997 at every step and both CFG
|
| 60 |
branches. PSNR is not comparable across prompts: a texture-heavy oil-painting prompt scores
|
|
|
|
| 62 |
|
| 63 |
## Usage
|
| 64 |
|
| 65 |
+
Run it in [CoreAIImageGen](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/CoreAIImageGen)
|
| 66 |
+
(macOS): pick "Z-Image-Turbo 512" or "… 1024" → Download & Load → Generate. The host loop is
|
| 67 |
+
[`ZImagePipeline.swift`](https://github.com/john-rocky/coreai-model-zoo/blob/main/apps/CoreAIImageGen/Sources/ZImagePipeline.swift);
|
| 68 |
+
the Python twin is
|
| 69 |
+
[`conversion/zimage/pipeline_engine.py`](https://github.com/john-rocky/coreai-model-zoo/blob/main/conversion/zimage/pipeline_engine.py).
|
| 70 |
+
Both agree with the fp32 reference to ~42.6 dB.
|
| 71 |
+
|
| 72 |
+
The DiT graph takes host-prepped inputs (patchify, RoPE, pad masks) and returns the velocity;
|
| 73 |
+
the sampler loop lives on the host:
|
| 74 |
|
| 75 |
```python
|
| 76 |
# per step, for cond and uncond:
|