Diffusers
Safetensors
OrbitQuantComponentArtifact
orbitquant
quantized
diffusion-transformer
8-bit precision
Instructions to use WaveCut/Z-Image-Turbo-OrbitQuant-W3A3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use WaveCut/Z-Image-Turbo-OrbitQuant-W3A3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("WaveCut/Z-Image-Turbo-OrbitQuant-W3A3", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Document OrbitQuant 0.4.0 on-the-fly conversion
Browse files- README.md +27 -1
- SHA256SUMS +1 -1
README.md
CHANGED
|
@@ -19,7 +19,7 @@ OrbitQuant is a calibration-free post-training quantization method for image and
|
|
| 19 |
Install OrbitQuant and the Hugging Face runtime dependencies:
|
| 20 |
|
| 21 |
```bash
|
| 22 |
-
pip install "orbitquant[hf,kernels]>=0.
|
| 23 |
```
|
| 24 |
|
| 25 |
Download this model repository as an OrbitQuant artifact, then load the source Diffusers pipeline with the quantized component patched in:
|
|
@@ -49,6 +49,31 @@ image = pipe(
|
|
| 49 |
image.save("z-image-orbitquant.png")
|
| 50 |
```
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
`runtime_mode="auto_fused"` is the default optimized runtime. On CUDA, the `kernels` extra provides the Triton packed fallback; a locally built native CUDA package is preferred automatically when installed. On MPS, build and install the native Metal package from the OrbitQuant source tree. See the [OrbitQuant runtime instructions](https://github.com/iamwavecut/OrbitQuant/blob/main/docs/kernel-audit.md#local-native-package). Use `runtime_mode="dequant_bf16"` only as an explicit compatibility/debug reference path.
|
| 53 |
|
| 54 |
## Native Settings
|
|
@@ -167,5 +192,6 @@ The following assets are stored in this artifact and compare the BF16 base gener
|
|
| 167 |
## Limitations
|
| 168 |
|
| 169 |
- This is a transformer-component artifact; load it into the source pipeline as shown above.
|
|
|
|
| 170 |
- CUDA and MPS `auto_fused` inference requires a packed matmul kernel and fails loudly when the required kernel is unavailable. The explicit `dequant_bf16` reference mode materializes dequantized weights before BF16 matmul.
|
| 171 |
- Quality depends on the source model and bit setting. Very low-bit settings can degrade prompt following or visual detail.
|
|
|
|
| 19 |
Install OrbitQuant and the Hugging Face runtime dependencies:
|
| 20 |
|
| 21 |
```bash
|
| 22 |
+
pip install "orbitquant[hf,kernels]>=0.4.0"
|
| 23 |
```
|
| 24 |
|
| 25 |
Download this model repository as an OrbitQuant artifact, then load the source Diffusers pipeline with the quantized component patched in:
|
|
|
|
| 49 |
image.save("z-image-orbitquant.png")
|
| 50 |
```
|
| 51 |
|
| 52 |
+
### Convert the source checkpoint on load
|
| 53 |
+
|
| 54 |
+
For a safetensors source checkpoint, OrbitQuant can row-stream the denoiser into packed weights through the normal Diffusers loader. Use sequential offload by replacing the final call with `pipe.enable_sequential_cpu_offload()`.
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
import torch
|
| 58 |
+
import orbitquant
|
| 59 |
+
from diffusers import DiffusionPipeline
|
| 60 |
+
from orbitquant import (
|
| 61 |
+
OrbitQuantConfig,
|
| 62 |
+
build_diffusers_pipeline_quantization_config,
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
qconfig = build_diffusers_pipeline_quantization_config(
|
| 66 |
+
OrbitQuantConfig(target_policy="auto"),
|
| 67 |
+
components="transformer",
|
| 68 |
+
)
|
| 69 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 70 |
+
"Tongyi-MAI/Z-Image-Turbo",
|
| 71 |
+
quantization_config=qconfig,
|
| 72 |
+
torch_dtype=torch.bfloat16,
|
| 73 |
+
)
|
| 74 |
+
pipe.enable_model_cpu_offload()
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
`runtime_mode="auto_fused"` is the default optimized runtime. On CUDA, the `kernels` extra provides the Triton packed fallback; a locally built native CUDA package is preferred automatically when installed. On MPS, build and install the native Metal package from the OrbitQuant source tree. See the [OrbitQuant runtime instructions](https://github.com/iamwavecut/OrbitQuant/blob/main/docs/kernel-audit.md#local-native-package). Use `runtime_mode="dequant_bf16"` only as an explicit compatibility/debug reference path.
|
| 78 |
|
| 79 |
## Native Settings
|
|
|
|
| 192 |
## Limitations
|
| 193 |
|
| 194 |
- This is a transformer-component artifact; load it into the source pipeline as shown above.
|
| 195 |
+
- Guaranteed on-the-fly bounded-memory conversion requires a safetensors source checkpoint. Unknown architectures have structural coverage only and require policy inspection plus quality validation.
|
| 196 |
- CUDA and MPS `auto_fused` inference requires a packed matmul kernel and fails loudly when the required kernel is unavailable. The explicit `dequant_bf16` reference mode materializes dequantized weights before BF16 matmul.
|
| 197 |
- Quality depends on the source model and bit setting. Very low-bit settings can degrade prompt following or visual detail.
|
SHA256SUMS
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
356d2edc39b6c6d55c357b9cadcf999b2b712fbb56975f5a64847d72dc5f6d4c assets/image_generation_comparison_matrix.webp
|
| 3 |
c47ce5750ec67382f1011fd6094722db671ebef7ecff1248d04b384a2808fd8f benchmark/summary.json
|
| 4 |
13e6cfb9a08f889f2b09acd8a467af246819742d72c653d2b66098b2fcca6da8 model.safetensors
|
|
|
|
| 1 |
+
6dc2ccf5a97197b69383c07ec94989900aa5826b046297ba9575f413f2d20a5a README.md
|
| 2 |
356d2edc39b6c6d55c357b9cadcf999b2b712fbb56975f5a64847d72dc5f6d4c assets/image_generation_comparison_matrix.webp
|
| 3 |
c47ce5750ec67382f1011fd6094722db671ebef7ecff1248d04b384a2808fd8f benchmark/summary.json
|
| 4 |
13e6cfb9a08f889f2b09acd8a467af246819742d72c653d2b66098b2fcca6da8 model.safetensors
|