kruatech commited on
Commit
981148e
·
verified ·
1 Parent(s): 6dcc658

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +18 -7
README.md CHANGED
@@ -65,13 +65,24 @@ The `-q4` folders sit at the top level rather than inside the bf16 ones, so an i
65
 
66
  **Use the 4-bit folders.** Quantization is MLX affine: 4 bits per weight with a bf16 scale and bias for every group of 64, about 4.5 bits per weight and 28-30% of the bf16 size. Normalizations, modulations and the encoder's embedding table stay in bf16, and matrix multiplication still runs in bf16 - the gain is memory and load time, not integer arithmetic.
67
 
68
- | | bf16 | 4-bit |
69
- |------------------------------------|-----------|----------|
70
- | Z-Image DiT | 11.46 GiB | 3.40 GiB |
71
- | klein DiT | 7.22 GiB | 2.03 GiB |
72
- | shared encoder | 7.51 GiB | 2.58 GiB |
73
- | klein 1024 px, 4 steps, wall clock | 170 s | 73 s |
74
- | of which the 4 steps themselves | 35 s | 32 s |
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  Output quality was indistinguishable: the same prompt and seed gave two clean images that differ the way two seeds differ. The bf16 folders exist as the accuracy reference a port can be checked against.
77
 
 
65
 
66
  **Use the 4-bit folders.** Quantization is MLX affine: 4 bits per weight with a bf16 scale and bias for every group of 64, about 4.5 bits per weight and 28-30% of the bf16 size. Normalizations, modulations and the encoder's embedding table stay in bf16, and matrix multiplication still runs in bf16 - the gain is memory and load time, not integer arithmetic.
67
 
68
+ | component | bf16 | 4-bit | ratio |
69
+ |---------------------|-----------|----------|-------|
70
+ | Z-Image DiT | 11.46 GiB | 3.40 GiB | 30% |
71
+ | klein DiT | 7.22 GiB | 2.03 GiB | 28% |
72
+ | shared text encoder | 7.51 GiB | 2.58 GiB | 34% |
73
+
74
+ The encoder ratio is higher on purpose: its 151936 x 2560 embedding table stays in bf16, because quantizing it moved the encoder output by 3e-01 in testing.
75
+
76
+ What that buys, on one klein run at 1024 px with 4 steps:
77
+
78
+ | phase | bf16 | 4-bit |
79
+ |-----------------------|-------|-------|
80
+ | read the text encoder | 40 s | 22 s |
81
+ | read the transformer | 58 s | 19 s |
82
+ | 4 diffusion steps | 35 s | 32 s |
83
+ | total | 170 s | 73 s |
84
+
85
+ The steps themselves barely change: multiplication still happens in bf16, the kernel unpacks each group of 64 weights on the fly. The saving is disk reading, which is why it depends on your storage - these figures come from an external volume at about 0.2 GiB/s.
86
 
87
  Output quality was indistinguishable: the same prompt and seed gave two clean images that differ the way two seeds differ. The bf16 folders exist as the accuracy reference a port can be checked against.
88