huggingface / huggingface/diffusers

FluxFillPipeline quality deteriorates over multiple iterations of inpainting

Open
#10,204 9 comments 0 reactions 0 assignees View on GitHub
bug stale
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
91

Description

### Describe the bug

When the FluxFillPipeline is run multiple times on the same image, the image quality deteriorates in each iteration.

### Reproduction

```python
import torch
from diffusers import FluxFillPipeline
from diffusers.utils import load_image

pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16)
pipe = pipe.to("cuda")

img = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup.png")
mask = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup_mask.png")

def fill(prompt, image, mask):
return pipe(
prompt=prompt,
image=image,
mask_image=mask,
guidance_scale=30,
num_inference_steps=50,
max_sequence_length=512,
height=1632,
width=1232,
generator=torch.Generator("cpu").manual_seed(0),
).images[0]

prompt = "a white paper cup"
for i in range(12):
print(i)
img = fill(prompt, img, mask)
img.save(f"output_{i}.png")
```

### Logs

![output_0](https://github.com/user-attachments/assets/ef11a37e-377d-4b1c-b573-5310d634db81)
![output_10](https://github.com/user-attachments/assets/996160b6-9835-4dc8-82c1-baca339cbb61)

### System Info

Diffusers Version 0.31.0
Python Version 3.10
CUDA Version 12.1.0
DGX H100

### Who can help?

@yiyixuxu @DN6 @aso

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.