File size: 3,844 Bytes
5b81477 09e29ce 5b81477 c793179 5b81477 697b11c 5b81477 c793179 5b81477 c793179 5b81477 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
---
base_model:
- Tongyi-MAI/Z-Image-Turbo
tags:
- text-to-image
- image-generation
- gguf
license: apache-2.0
---
Quantized GGUF versions of the [Z-Image Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) by Tongyi-Mai.
### 📂 Available Models
| Model | Download |
|--------|--------------|
| Z-Image Turbo GGUF | [Download](https://huggingface.co/jayn7/Z-Image-Turbo-GGUF/tree/main) |
| Qwen3-4B (Text Encoder) | [unsloth/Qwen3-4B-GGUF](https://huggingface.co/unsloth/Qwen3-4B-GGUF)
### 📷 Example Comparison



### Model Information
Check out the original model card [Z-Image Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) for detailed information about the model.
### Usage
The model can be used with:
- [**ComfyUI-GGUF**](https://github.com/city96/ComfyUI-GGUF) by **city96**
- [**Diffusers**](https://github.com/huggingface/diffusers)
#### Example Usage
<details>
<summary>Diffusers</summary>
```sh
pip install git+https://github.com/huggingface/diffusers
```
```py
from diffusers import ZImagePipeline, ZImageTransformer2DModel, GGUFQuantizationConfig
import torch
prompt = "Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights."
height = 1024
width = 1024
seed = 42
#hf_path = "https://huggingface.co/jayn7/Z-Image-Turbo-GGUF/blob/main/z_image_turbo-Q3_K_M.gguf"
local_path = "path\to\local\model\z_image_turbo-Q3_K_M.gguf"
transformer = ZImageTransformer2DModel.from_single_file(
local_path,
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
dtype=torch.bfloat16,
)
pipeline = ZImagePipeline.from_pretrained(
"Tongyi-MAI/Z-Image-Turbo",
transformer=transformer,
dtype=torch.bfloat16,
).to("cuda")
# [Optional] Attention Backend
# Diffusers uses SDPA by default. Switch to Custom attention backend for better efficiency if supported:
#pipeline.transformer.set_attention_backend("_sage_qk_int8_pv_fp16_triton") # Enable Sage Attention
#pipeline.transformer.set_attention_backend("flash") # Enable Flash-Attention-2
#pipeline.transformer.set_attention_backend("_flash_3") # Enable Flash-Attention-3
# [Optional] Model Compilation
# Compiling the DiT model accelerates inference, but the first run will take longer to compile.
#pipeline.transformer.compile()
# [Optional] CPU Offloading
# Enable CPU offloading for memory-constrained devices.
#pipeline.enable_model_cpu_offload()
images = pipeline(
prompt=prompt,
num_inference_steps=9, # This actually results in 8 DiT forwards
guidance_scale=0.0, # Guidance should be 0 for the Turbo models
height=height,
width=width,
generator=torch.Generator("cuda").manual_seed(seed)
).images[0]
images.save("zimage.png")
```
</details>
### Credits
- **Original Model**: [Z-Image Turbo by Tongyi-MAI](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo)
- **Quantization Tools & Guide**: [llama.cpp](https://github.com/ggml-org/llama.cpp) & [city96](https://github.com/city96/ComfyUI-GGUF/blob/main/tools/README.md)
### License
This repository follows the same license as the [Z-Image Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo). |