Disty0 commited on
Commit
a552683
·
verified ·
1 Parent(s): 3cf2d4e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -3
README.md CHANGED
@@ -1,3 +1,44 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model_relation: quantized
4
+ library_name: diffusers
5
+ tags:
6
+ - sdnq
7
+ - z_image
8
+ - 4-bit
9
+ base_model:
10
+ - Tongyi-MAI/Z-Image-Turbo
11
+ ---
12
+ 4 bit (UINT4 with SVD rank 32) quantization of [Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) using [SDNQ](https://github.com/vladmandic/sdnext/wiki/SDNQ-Quantization).
13
+
14
+ Usage:
15
+ ```
16
+ pip install git+https://github.com/Disty0/sdnq
17
+ ```
18
+
19
+ ```py
20
+ import torch
21
+ import diffusers
22
+ from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
23
+
24
+ pipe = diffusers.ZImagePipeline.from_pretrained("Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
25
+ pipe.enable_model_cpu_offload()
26
+
27
+ 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."
28
+ image = pipe(
29
+ prompt=prompt,
30
+ height=1024,
31
+ width=1024,
32
+ num_inference_steps=9,
33
+ guidance_scale=0.0,
34
+ generator=torch.manual_seed(42),
35
+ ).images[0]
36
+ image.save("z-image-turbo-sdnq-uint4-svd-r32.png")
37
+ ```
38
+
39
+ Original BF16 vs SDNQ quantization comparison:
40
+
41
+ | Quantization | Model Size | Visualization |
42
+ | --- | --- | --- |
43
+ | Original BF16 | 12.3 GB | ![Original BF16](https://cdn-uploads.huggingface.co/production/uploads/6456af6195082f722d178522/EIgp3eGCYBHZkU3SolV3R.png) |
44
+ | SDNQ UINT4 | 3.5 GB | ![SDNQ UINT4](https://cdn-uploads.huggingface.co/production/uploads/6456af6195082f722d178522/JXHLVC342SQz30eyKreDH.png) |