Disty0 commited on
Commit
0f7a765
·
verified ·
1 Parent(s): ae64dc0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -3
README.md CHANGED
@@ -1,3 +1,46 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - vladmandic/Qwen-Lightning
5
+ library_name: diffusers
6
+ tags:
7
+ - sdnq
8
+ - qwen_image
9
+ ---
10
+ 4 bit (UINT4 with SVD rank 32) quantization of [vladmandic/Qwen-Lightning](https://huggingface.co/vladmandic/Qwen-Lightning) using [SDNQ](https://github.com/vladmandic/sdnext/wiki/SDNQ-Quantization).
11
+
12
+ Usage:
13
+ ```
14
+ pip install git+https://github.com/Disty0/sdnq
15
+ ```
16
+
17
+ ```py
18
+ import torch
19
+ import diffusers
20
+ from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
21
+
22
+ pipe = diffusers.QwenImagePipeline.from_pretrained("Disty0/Qwen-Image-Lightning-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
23
+ pipe.enable_model_cpu_offload()
24
+
25
+ prompt = "a tiny astronaut hatching from an egg on the moon, Ultra HD, 4K, cinematic composition."
26
+ negative_prompt = " "
27
+ image = pipe(
28
+ prompt=prompt,
29
+ negative_prompt=negative_prompt,
30
+ width=1024,
31
+ height=1024,
32
+ num_inference_steps=8,
33
+ true_cfg_scale=1.0,
34
+ generator=torch.manual_seed(0),
35
+ ).images[0]
36
+
37
+ image.save("qwen-image-lightning-sdnq-uint4-svd-r32.png")
38
+ ```
39
+
40
+
41
+ Original BF16 vs SDNQ quantization comparison:
42
+
43
+ | Quantization | Model Size | Visualization |
44
+ | --- | --- | --- |
45
+ | Original BF16 | 40.9 GB | ![Original BF16](https://cdn-uploads.huggingface.co/production/uploads/6456af6195082f722d178522/OQ9vhQij2b4tBMxzlOa4e.png) |
46
+ | SDNQ UINT4 | 11.6 GB | ![SDNQ UINT4](https://cdn-uploads.huggingface.co/production/uploads/6456af6195082f722d178522/i803Rv8HAwhi8b0H1J-jU.png) |