Skip to content

Noisy pattern on qwen image edit outputsΒ #78

@andrijazz

Description

@andrijazz

Hi, thanks for the amazing work!

I am getting this noisy pattern consistently when using qwen image edit. It gets significantly more visible when used with lighting lora.

Image

Here is the code snippet.

import math
import torch
from diffusers import QwenImageEditPipeline, FlowMatchEulerDiscreteScheduler
from PIL import Image

scheduler_config = {
    "base_image_seq_len": 256,
    "base_shift": math.log(3),  # We use shift=3 in distillation
    "invert_sigmas": False,
    "max_image_seq_len": 8192,
    "max_shift": math.log(3),  # We use shift=3 in distillation
    "num_train_timesteps": 1000,
    "shift": 1.0,
    "shift_terminal": None,  # set shift_terminal to None
    "stochastic_sampling": False,
    "time_shift_type": "exponential",
    "use_beta_sigmas": False,
    "use_dynamic_shifting": True,
    "use_exponential_sigmas": False,
    "use_karras_sigmas": False,
}
scheduler = FlowMatchEulerDiscreteScheduler.from_config(scheduler_config)
pipeline = QwenImageEditPipeline.from_pretrained("Qwen/Qwen-Image-Edit", scheduler=scheduler, torch_dtype=torch.bfloat16)
pipeline.to("cuda")
pipeline.load_lora_weights("/storage/models/Qwen-Image-Edit-Lightning-8steps-V1.0-bf16.safetensors")

image = Image.open("bike_test.png")
prompt = "Change the background to a park on a sunny day."
output = pipeline(
    image,
    prompt,
    num_inference_steps=8,
    true_cfg_scale=1.0,
    negative_prompt=" ",
    height=1024,
    width=1024,
    num_images_per_prompt=1,
    generator=torch.Generator(device="cuda").manual_seed(0)
).images[0]
output.save("output.png")

Any suggestions how to get around this issue? I found that it looks slightly better when used with default scheduler configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions