Image-to-Image
Diffusers
Safetensors
QwenImageEditPlusPipeline
sdnq
qwen_image
4-bit precision
8-bit precision
Instructions to use Disty0/Qwen-Image-Edit-2509-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-Edit-2509-SDNQ-uint4-svd-r32 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Disty0/Qwen-Image-Edit-2509-SDNQ-uint4-svd-r32", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- Qwen/Qwen-Image-Edit-2509
|
| 5 |
+
library_name: diffusers
|
| 6 |
+
tags:
|
| 7 |
+
- sdnq
|
| 8 |
+
- qwen_image
|
| 9 |
+
---
|
| 10 |
+
4 bit (UINT4 with SVD rank 32) quantization of [Qwen/Qwen-Image-Edit-2509](https://huggingface.co/Qwen/Qwen-Image-Edit-2509) 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.QwenImageEditPlusPipeline.from_pretrained("Disty0/Qwen-Image-Edit-2509-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
|
| 23 |
+
pipe.enable_model_cpu_offload()
|
| 24 |
+
pipe.set_progress_bar_config(disable=None)
|
| 25 |
+
|
| 26 |
+
image1 = Image.open("input1.png")
|
| 27 |
+
image2 = Image.open("input2.png")
|
| 28 |
+
prompt = "The magician bear is on the left, the alchemist bear is on the right, facing each other in the central park square."
|
| 29 |
+
inputs = {
|
| 30 |
+
"image": [image1, image2],
|
| 31 |
+
"prompt": prompt,
|
| 32 |
+
"generator": torch.manual_seed(0),
|
| 33 |
+
"true_cfg_scale": 4.0,
|
| 34 |
+
"negative_prompt": " ",
|
| 35 |
+
"num_inference_steps": 40,
|
| 36 |
+
"guidance_scale": 1.0,
|
| 37 |
+
"num_images_per_prompt": 1,
|
| 38 |
+
}
|
| 39 |
+
with torch.inference_mode():
|
| 40 |
+
output = pipeline(**inputs)
|
| 41 |
+
output_image = output.images[0]
|
| 42 |
+
output_image.save("output_image_edit_plus.png")
|
| 43 |
+
|
| 44 |
+
image.save("qwen-image-edit-2509-sdnq-uint4-svd-r32.png")
|
| 45 |
+
```
|