Text-to-Image
Diffusers
Safetensors
QwenImagePipeline
sdnq
qwen_image
4-bit precision
8-bit precision
Instructions to use Disty0/Qwen-Image-Lightning-SDNQ-uint4-svd-r32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Disty0/Qwen-Image-Lightning-SDNQ-uint4-svd-r32 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Disty0/Qwen-Image-Lightning-SDNQ-uint4-svd-r32", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Update README.md
Browse files
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 |  |
|
| 46 |
+
| SDNQ UINT4 | 11.6 GB |  |
|