When used with diffusers, the generated image has weird color

#9
by weathon - opened

Original image:

image

Output image:

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

Sign up or log in to comment