jayn7 commited on
Commit
c793179
·
verified ·
1 Parent(s): 46da0f5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -1
README.md CHANGED
@@ -13,6 +13,10 @@ Quantized GGUF versions of the [Z-Image Turbo](https://huggingface.co/Tongyi-MAI
13
  | Model | Download |
14
  |--------|--------------|
15
  | Z-Image Turbo GGUF | [Download](https://huggingface.co/jayn7/Z-Image-Turbo-GGUF/tree/main) |
 
 
 
 
16
 
17
  ### 📷 Example Comparison
18
  ![z_image_comparison_1](https://cdn-uploads.huggingface.co/production/uploads/651f78681719ac0cec346537/ILKCwkG5LkjF2ZrAXXRbJ.png)
@@ -29,8 +33,69 @@ Check out the original model card [Z-Image Turbo](https://huggingface.co/Tongyi-
29
 
30
  The model can be used with:
31
 
32
- - [**ComfyUI-GGUF**](https://github.com/city96/ComfyUI-GGUF) by **city96**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
 
34
 
35
 
36
  ### Credits
 
13
  | Model | Download |
14
  |--------|--------------|
15
  | Z-Image Turbo GGUF | [Download](https://huggingface.co/jayn7/Z-Image-Turbo-GGUF/tree/main) |
16
+ | Qwen3-4B (Text Encoder) | [unsloth/Qwen3-4B-GGUF](https://huggingface.co/unsloth/Qwen3-4B-GGUF)
17
+
18
+ ### Text Encoders
19
+
20
 
21
  ### 📷 Example Comparison
22
  ![z_image_comparison_1](https://cdn-uploads.huggingface.co/production/uploads/651f78681719ac0cec346537/ILKCwkG5LkjF2ZrAXXRbJ.png)
 
33
 
34
  The model can be used with:
35
 
36
+ - [**ComfyUI-GGUF**](https://github.com/city96/ComfyUI-GGUF) by **city96**
37
+ - [**Diffusers**](https://github.com/huggingface/diffusers)
38
+
39
+ #### Example Usage
40
+
41
+ <details>
42
+ <summary>Diffusers</summary>
43
+
44
+ ```sh
45
+ pip install git+https://github.com/huggingface/diffusers
46
+ ```
47
+
48
+ ```py
49
+ from diffusers import ZImagePipeline, ZImageTransformer2DModel, GGUFQuantizationConfig
50
+ import torch
51
+
52
+ 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."
53
+ height = 1024
54
+ width = 1024
55
+ seed = 42
56
+
57
+ #hf_path = "https://huggingface.co/jayn7/Z-Image-Turbo-GGUF/blob/main/z_image_turbo-Q3_K_M.gguf"
58
+ local_path = "path\to\local\model\z_image_turbo-Q3_K_M.gguf"
59
+
60
+ transformer = ZImageTransformer2DModel.from_single_file(
61
+ local_path,
62
+ quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
63
+ dtype=torch.bfloat16,
64
+ )
65
+
66
+ pipeline = ZImagePipeline.from_pretrained(
67
+ "Tongyi-MAI/Z-Image-Turbo",
68
+ transformer=transformer,
69
+ dtype=torch.bfloat16,
70
+ ).to("cuda")
71
+
72
+ # [Optional] Attention Backend
73
+ # Diffusers uses SDPA by default. Switch to Custom attention backend for better efficiency if supported:
74
+ #pipeline.transformer.set_attention_backend("_sage_qk_int8_pv_fp16_triton") # Enable Sage Attention
75
+ #pipeline.transformer.set_attention_backend("flash") # Enable Flash-Attention-2
76
+ #pipeline.transformer.set_attention_backend("_flash_3") # Enable Flash-Attention-3
77
+
78
+ # [Optional] Model Compilation
79
+ # Compiling the DiT model accelerates inference, but the first run will take longer to compile.
80
+ #pipeline.transformer.compile()
81
+
82
+ # [Optional] CPU Offloading
83
+ # Enable CPU offloading for memory-constrained devices.
84
+ #pipeline.enable_model_cpu_offload()
85
+
86
+ images = pipeline(
87
+ prompt=prompt,
88
+ num_inference_steps=9, # This actually results in 8 DiT forwards
89
+ guidance_scale=0.0, # Guidance should be 0 for the Turbo models
90
+ height=height,
91
+ width=width,
92
+ generator=torch.Generator("cuda").manual_seed(seed)
93
+ ).images[0]
94
+
95
+ images.save("zimage.png")
96
+ ```
97
 
98
+ </details>
99
 
100
 
101
  ### Credits