Update with example script
Browse files
README.md
CHANGED
|
@@ -13,6 +13,51 @@ base_model:
|
|
| 13 |
- Tongyi-MAI/Z-Image-Turbo
|
| 14 |
---
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
<h1 align="center">⚡️- Image<br><sub><sup>An Efficient Image Generation Foundation Model with Single-Stream Diffusion Transformer</sup></sub></h1>
|
| 18 |
|
|
|
|
| 13 |
- Tongyi-MAI/Z-Image-Turbo
|
| 14 |
---
|
| 15 |
|
| 16 |
+
This is a BitsandBytes quantized version of [Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo), and can be run in `diffusers`. <br>
|
| 17 |
+
unsloth/Z-Image-Turbo-unsloth-bnb-4bit uses [Unsloth Dynamic 2.0](https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs) methodology for SOTA performance.
|
| 18 |
+
|
| 19 |
+
- Important layers are upcasted to higher precision.
|
| 20 |
+
- You can use the model in the `diffusers` library.
|
| 21 |
+
|
| 22 |
+
```
|
| 23 |
+
from diffusers import DiffusionPipeline
|
| 24 |
+
import torch
|
| 25 |
+
|
| 26 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 27 |
+
"unsloth/Z-Image-Turbo-unsloth-bnb-4bit",
|
| 28 |
+
torch_dtype=torch.bfloat16,
|
| 29 |
+
).to('cuda')
|
| 30 |
+
|
| 31 |
+
# uncomment if you run out of memory
|
| 32 |
+
# pipe.enable_model_cpu_offload()
|
| 33 |
+
|
| 34 |
+
output = pipe(
|
| 35 |
+
prompt="a cute kawaii sloth",
|
| 36 |
+
negative_prompt="blurry, unfocused",
|
| 37 |
+
num_inference_steps=9,
|
| 38 |
+
guidance_scale=1.0,
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
# Save output
|
| 42 |
+
image = output.images[0]
|
| 43 |
+
image.save('sample.png')
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
<div>
|
| 47 |
+
<div style="display: flex; gap: 5px; align-items: center; ">
|
| 48 |
+
<a href="https://github.com/unslothai/unsloth/">
|
| 49 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
| 50 |
+
</a>
|
| 51 |
+
<a href="https://discord.gg/unsloth">
|
| 52 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 53 |
+
</a>
|
| 54 |
+
<a href="https://unsloth.ai/docs/models/qwen-image-2512">
|
| 55 |
+
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 56 |
+
</a>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
|
| 62 |
<h1 align="center">⚡️- Image<br><sub><sup>An Efficient Image Generation Foundation Model with Single-Stream Diffusion Transformer</sup></sub></h1>
|
| 63 |
|