Instructions to use kruatech/studio-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use kruatech/studio-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download kruatech/studio-mlx --local-dir studio-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload folder using huggingface_hub
Browse files
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 |
-
|
|
| 69 |
-
|--------------------------------
|
| 70 |
-
| Z-Image DiT
|
| 71 |
-
| klein DiT
|
| 72 |
-
| shared encoder
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|