Image-to-Image
Diffusers
Safetensors
Diffusion Single File
comfyui
distillation
LoRA
lora
Qwen-Image
Qwen-Image-Edit
Instructions to use lightx2v/Qwen-Image-Edit-2511-Lightning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use lightx2v/Qwen-Image-Edit-2511-Lightning with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2511", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("lightx2v/Qwen-Image-Edit-2511-Lightning") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Diffusion Single File
How to use lightx2v/Qwen-Image-Edit-2511-Lightning with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
When used with diffusers, the generated image has weird color
#9
by weathon - opened
Original image:
Output image:
prompt:
'移除图像中的mouthpiece'
code:
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
import torch
import math
# Scheduler configuration for Lightning
scheduler_config = {
"base_image_seq_len": 256,
"base_shift": math.log(3),
"invert_sigmas": False,
"max_image_seq_len": 8192,
"max_shift": math.log(3),
"num_train_timesteps": 1000,
"shift": 1.0,
"shift_terminal": None,
"stochastic_sampling": False,
"time_shift_type": "exponential",
"use_beta_sigmas": False,
"use_dynamic_shifting": True,
"use_exponential_sigmas": False,
"use_karras_sigmas": False,
}
dtype = torch.bfloat16
device = "cuda"
# Initialize scheduler with Lightning config
scheduler = FlowMatchEulerDiscreteScheduler.from_config(scheduler_config)
from diffusers import FlowMatchEulerDiscreteScheduler, QwenImageEditPlusPipeline
# Load the model pipeline
pipe = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2511",
scheduler=scheduler,
torch_dtype=dtype).to(device)
pipe.load_lora_weights(
"lightx2v/Qwen-Image-Edit-2511-Lightning",
weight_name="Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors"
)
pipe.fuse_lora()
image = pipe(
image=ds["train"][idx]["original_image"],
prompt="移除图像中的 " + ds["train"][idx]["object"],
negative_prompt="",
num_inference_steps=4,
).images

