Views
No views yet
1import os
2from PIL import Image
3import torch
4
5from diffusers import QwenImageEditPlusPipeline
6
7model_path = "ovedrive/Qwen-Image-Edit-2511-4bit"
8pipeline = QwenImageEditPlusPipeline.from_pretrained(model_path, torch_dtype=torch.bfloat16)
9print("pipeline loaded") # not true but whatever. do not move to cuda
10
11pipeline.set_progress_bar_config(disable=None)
12pipeline.enable_model_cpu_offload() #if you have enough VRAM replace this line with `pipeline.to("cuda")` which is 20GB VRAM
13image = Image.open("./example.png").convert("RGB")
14prompt = "Remove the lady head with white hair"
15inputs = {
16 "image": image,
17 "prompt": prompt,
18 "generator": torch.manual_seed(0),
19 "true_cfg_scale": 4.0,
20 "negative_prompt": " ",
21 "num_inference_steps": 20, # even 10 steps should be enough in many cases
22}
23
24with torch.inference_mode():
25 output = pipeline(**inputs)
26
27output_image = output.images[0]
28output_image.save("output_image_edit.png")
29print("image saved at", os.path.abspath("output_image_edit.png"))diffusers prevented lora from attaching.1@misc{wu2025qwenimagetechnicalreport,
2 title={Qwen-Image Technical Report},
3 author={Chenfei Wu and Jiahao Li and Jingren Zhou and Junyang Lin and Kaiyuan Gao and Kun Yan and Sheng-ming Yin and Shuai Bai and Xiao Xu and Yilei Chen and Yuxiang Chen and Zecheng Tang and Zekai Zhang and Zhengyi Wang and An Yang and Bowen Yu and Chen Cheng and Dayiheng Liu and Deqing Li and Hang Zhang and Hao Meng and Hu Wei and Jingyuan Ni and Kai Chen and Kuan Cao and Liang Peng and Lin Qu and Minggang Wu and Peng Wang and Shuting Yu and Tingkun Wen and Wensen Feng and Xiaoxiao Xu and Yi Wang and Yichang Zhang and Yongqiang Zhu and Yujia Wu and Yuxuan Cai and Zenan Liu},
4 year={2025},
5 eprint={2508.02324},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2508.02324},
9}