Disty0's picture
Update README.md
a2bf93b verified
metadata
license: apache-2.0
base_model:
  - vladmandic/Qwen-Lightning-Edit
base_model_relation: quantized
library_name: diffusers
tags:
  - sdnq
  - qwen_image
  - 4-bit

4 bit (UINT4 with SVD rank 32) quantization of vladmandic/Qwen-Lightning-Edit using SDNQ.

Usage:

pip install git+https://github.com/Disty0/sdnq
import torch
import diffusers
from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers

pipe = diffusers.QwenImageEditPipeline.from_pretrained("Disty0/Qwen-Image-Edit-Lightning-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.set_progress_bar_config(disable=None)

image1 = Image.open("input1.png")
image2 = Image.open("input2.png")
prompt = "The magician bear is on the left, the alchemist bear is on the right, facing each other in the central park square."
inputs = {
    "image": [image1, image2],
    "prompt": prompt,
    "generator": torch.manual_seed(0),
    "true_cfg_scale": 1.0,
    "negative_prompt": " ",
    "num_inference_steps": 8,
    "guidance_scale": 1.0,
    "num_images_per_prompt": 1,
}
with torch.inference_mode():
    output = pipeline(**inputs)
    output_image = output.images[0]
    output_image.save("qwen-image-edit-lightning-sdnq-uint4-svd-r32.png")