Diffusers
Safetensors
OrbitQuantComponentArtifact
orbitquant
quantized
diffusion-transformer
8-bit precision
Instructions to use WaveCut/Z-Image-Turbo-OrbitQuant-W2A4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use WaveCut/Z-Image-Turbo-OrbitQuant-W2A4 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-W2A4", 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
Add model-specific OrbitQuant usage examples
Browse files- README.md +11 -8
- SHA256SUMS +1 -1
README.md
CHANGED
|
@@ -20,7 +20,7 @@ Install the package from this repository, then load the base pipeline and patch
|
|
| 20 |
|
| 21 |
```python
|
| 22 |
import torch
|
| 23 |
-
from diffusers import
|
| 24 |
from huggingface_hub import snapshot_download
|
| 25 |
from orbitquant import load_quantized_pipeline_component
|
| 26 |
|
|
@@ -28,7 +28,7 @@ base_model = "Tongyi-MAI/Z-Image-Turbo"
|
|
| 28 |
artifact_id = "WaveCut/Z-Image-Turbo-OrbitQuant-W2A4"
|
| 29 |
|
| 30 |
artifact_dir = snapshot_download(artifact_id, repo_type="model")
|
| 31 |
-
pipe =
|
| 32 |
base_model,
|
| 33 |
torch_dtype=torch.bfloat16,
|
| 34 |
)
|
|
@@ -40,13 +40,16 @@ load_quantized_pipeline_component(
|
|
| 40 |
)
|
| 41 |
pipe.to("cuda")
|
| 42 |
|
| 43 |
-
|
| 44 |
prompt="A precise product photo of a red ceramic mug on a wooden desk",
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
```
|
| 47 |
|
| 48 |
-
For model-specific pipelines, you may replace `DiffusionPipeline` with the matching Diffusers class, such as `FluxPipeline`, `Flux2KleinPipeline`, `ZImagePipeline`, or `WanPipeline` when your Diffusers version provides it.
|
| 49 |
-
|
| 50 |
## Quantization
|
| 51 |
|
| 52 |
- Method: `orbitquant`
|
|
@@ -73,14 +76,14 @@ For model-specific pipelines, you may replace `DiffusionPipeline` with the match
|
|
| 73 |
|
| 74 |
The following assets are stored in this artifact and compare the BF16 base generation against the OrbitQuant generation with the same prompt and seed.
|
| 75 |
|
|
|
|
|
|
|
| 76 |

|
| 77 |
|
| 78 |

|
| 79 |
|
| 80 |

|
| 81 |
|
| 82 |
-

|
| 83 |
-
|
| 84 |
## Source
|
| 85 |
|
| 86 |
- Model: `Tongyi-MAI/Z-Image-Turbo`
|
|
|
|
| 20 |
|
| 21 |
```python
|
| 22 |
import torch
|
| 23 |
+
from diffusers import ZImagePipeline
|
| 24 |
from huggingface_hub import snapshot_download
|
| 25 |
from orbitquant import load_quantized_pipeline_component
|
| 26 |
|
|
|
|
| 28 |
artifact_id = "WaveCut/Z-Image-Turbo-OrbitQuant-W2A4"
|
| 29 |
|
| 30 |
artifact_dir = snapshot_download(artifact_id, repo_type="model")
|
| 31 |
+
pipe = ZImagePipeline.from_pretrained(
|
| 32 |
base_model,
|
| 33 |
torch_dtype=torch.bfloat16,
|
| 34 |
)
|
|
|
|
| 40 |
)
|
| 41 |
pipe.to("cuda")
|
| 42 |
|
| 43 |
+
image = pipe(
|
| 44 |
prompt="A precise product photo of a red ceramic mug on a wooden desk",
|
| 45 |
+
height=1024,
|
| 46 |
+
width=1024,
|
| 47 |
+
num_inference_steps=10,
|
| 48 |
+
guidance_scale=0.0,
|
| 49 |
+
).images[0]
|
| 50 |
+
image.save("z-image-orbitquant.png")
|
| 51 |
```
|
| 52 |
|
|
|
|
|
|
|
| 53 |
## Quantization
|
| 54 |
|
| 55 |
- Method: `orbitquant`
|
|
|
|
| 76 |
|
| 77 |
The following assets are stored in this artifact and compare the BF16 base generation against the OrbitQuant generation with the same prompt and seed.
|
| 78 |
|
| 79 |
+

|
| 80 |
+
|
| 81 |

|
| 82 |
|
| 83 |

|
| 84 |
|
| 85 |

|
| 86 |
|
|
|
|
|
|
|
| 87 |
## Source
|
| 88 |
|
| 89 |
- Model: `Tongyi-MAI/Z-Image-Turbo`
|
SHA256SUMS
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 assets/.gitkeep
|
| 3 |
8c8731e445b7cefae4b0fb1aa5c716bc01b2c91f67e34d46bf6afc40a02aec0f assets/original_vs_orbitquant_z-image-native_seed0_W2A4_color-binding.webp
|
| 4 |
4a58042eadc55289dd18b1c0841e95dbd9a3f7ba4fa63178af43bfe4918ed8db assets/original_vs_orbitquant_z-image-native_seed0_W2A4_counting.webp
|
|
|
|
| 1 |
+
2a530f5e53e1f01a91d11263bcd7659a4016a14f3d14acaee1263ccb6da86749 README.md
|
| 2 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 assets/.gitkeep
|
| 3 |
8c8731e445b7cefae4b0fb1aa5c716bc01b2c91f67e34d46bf6afc40a02aec0f assets/original_vs_orbitquant_z-image-native_seed0_W2A4_color-binding.webp
|
| 4 |
4a58042eadc55289dd18b1c0841e95dbd9a3f7ba4fa63178af43bfe4918ed8db assets/original_vs_orbitquant_z-image-native_seed0_W2A4_counting.webp
|