Qwen-Image-Edit-Pruning

GitHub

Update

Introduction

This open-source project is based on Qwen-Image-Edit and has attempted model pruning, removing 20 layers while retaining the weights of 40 layers, resulting in a model size of 13.6B parameters. The pruned version will continue to be iterated upon. Please stay tuned.

Quick Start

Install the latest version of diffusers and pytorch

pip install torch
pip install git+https://github.com/huggingface/diffusers

Qwen-Image-Edit-2509-14B Inference

import os
import torch
from PIL import Image
from diffusers import QwenImageEditPlusPipeline
model_name = f"OPPOer/Qwen-Image-Edit-2509-Pruning/Qwen-Image-Edit-2509-14B"
pipeline = QwenImageEditPlusPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
print("pipeline loaded")
pipeline.to('cuda')
pipeline.set_progress_bar_config(disable=None)
image1 = Image.open("input1.jpg")
image2 = Image.open("input2.jpg")
prompt = "Let the ancient costume beauty in the second picture sit on the sofa in the first picture"
inputs = {
    "image": [image1, image2],
    "prompt": prompt,
    "generator": torch.manual_seed(0),
    "true_cfg_scale": 4.0,
    "negative_prompt": " ",
    "num_inference_steps": 40,
    "guidance_scale": 1.0,
    "num_images_per_prompt": 1,
}
with torch.inference_mode():
    output = pipeline(**inputs)
    output_image = output.images[0]
    output_image.save("output_image_edit_plus.png")
    print("image saved at", os.path.abspath("output_image_edit_plus.png"))

Qwen-Image-Edit-2509-13B Inference

import os
import torch
from PIL import Image
from diffusers import QwenImageEditPlusPipeline
model_name = f"OPPOer/Qwen-Image-Edit-2509-Pruning/Qwen-Image-Edit-2509-13B-4steps"
pipeline = QwenImageEditPlusPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
print("pipeline loaded")
pipeline.to('cuda')
pipeline.set_progress_bar_config(disable=None)
image1 = Image.open("input1.jpg")
image2 = Image.open("input2.jpg")
prompt = "Let the ancient costume beauty in the second picture sit on the sofa in the first picture"
inputs = {
    "image": [image1, image2],
    "prompt": prompt,
    "generator": torch.manual_seed(0),
    "true_cfg_scale": 1.0,
    "negative_prompt": " ",
    "num_inference_steps": 4,
    "guidance_scale": 1.0,
    "num_images_per_prompt": 1,
}
with torch.inference_mode():
    output = pipeline(**inputs)
    output_image = output.images[0]
    output_image.save("output_image_edit_plus.png")
    print("image saved at", os.path.abspath("output_image_edit_plus.png"))
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for OPPOer/Qwen-Image-Edit-2509-Pruning

Finetuned
(20)
this model

Dataset used to train OPPOer/Qwen-Image-Edit-2509-Pruning