This is a int8-wo pre-quantized version of Qwen-Image-Edit.
It needs at least 24GB VRAM GPU to run efficiently.

How to use

Install the latest version of diffusers, transformers, torchvision, torchao and accelerate:

pip install -U diffusers transformers torchvision torchao accelerate

The following contains a code snippet illustrating how to use the model to generate images based on image and text prompts:

import torch

from diffusers import AutoModel, DiffusionPipeline
from diffusers.utils import load_image

torch_dtype = torch.bfloat16
device = "cuda"

transformer = AutoModel.from_pretrained(
    "dimitribarbot/Qwen-Image-Edit-int8wo",
    torch_dtype=torch_dtype,
    use_safetensors=False
)
pipe = DiffusionPipeline.from_pretrained(
    "Qwen/Qwen-Image-Edit",
    transformer=transformer,
    torch_dtype=torch_dtype
)
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()

prompt = "change the dog plushie for a cat preserving the background, the lighting, colors, shadows, also the cat plushie should have the same style of the dog plushie with the same eyes and lines."

generator = torch.Generator(device=device).manual_seed(42)

ref_image = load_image("https://huggingface.co/datasets/OzzyGT/testing-resources/resolve/main/resources/dog_plushie.png").convert("RGB")

image = pipe(
    image=ref_image,
    prompt=prompt,
    num_inference_steps=25,
    true_cfg_scale=4.0,
    generator=generator
).images[0]

image.save("qwen_image_edit_torchao.png")

Credits

Downloads last month
136
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for dimitribarbot/Qwen-Image-Edit-int8wo

Quantized
(9)
this model