Views
No views yet
pip install sdnq1import torch
2import diffusers
3from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
4from sdnq.common import use_torch_compile as triton_is_available
5from sdnq.loader import apply_sdnq_options_to_model
6
7pipe = diffusers.QwenImageEditPlusPipeline.from_pretrained("Disty0/Qwen-Image-Edit-2511-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
8
9# Enable INT8 MatMul for AMD, Intel ARC and Nvidia GPUs:
10if triton_is_available and (torch.cuda.is_available() or torch.xpu.is_available()):
11 pipe.transformer = apply_sdnq_options_to_model(pipe.transformer, use_quantized_matmul=True)
12 pipe.text_encoder = apply_sdnq_options_to_model(pipe.text_encoder, use_quantized_matmul=True)
13 # pipe.transformer = torch.compile(pipe.transformer) # optional for faster speeds
14
15pipe.enable_model_cpu_offload()
16pipe.set_progress_bar_config(disable=None)
17
18image1 = Image.open("input1.png")
19image2 = Image.open("input2.png")
20prompt = "The magician bear is on the left, the alchemist bear is on the right, facing each other in the central park square."
21inputs = {
22 "image": [image1, image2],
23 "prompt": prompt,
24 "generator": torch.manual_seed(0),
25 "true_cfg_scale": 4.0,
26 "negative_prompt": " ",
27 "num_inference_steps": 40,
28 "guidance_scale": 1.0,
29 "num_images_per_prompt": 1,
30}
31with torch.inference_mode():
32 output = pipeline(**inputs)
33 output_image = output.images[0]
34 output_image.save("qwen-image-edit-2511-sdnq-uint4-svd-r32.png")