-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If we pass width/height in inference no changes in output image.
If we do not pass width/height, it defaults to 1024 x 1024 and crop the image.
Source image used (832 x 1216)

Reproduction
Working code but wrong image size as defaults to 1024 x 1024
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
pipeline = FluxKontextPipeline.from_pretrained(
"black-forest-labs/FLUX.1-Kontext-dev",
torch_dtype=torch.bfloat16
)
pipeline.enable_sequential_cpu_offload()
image = load_image(
"https://huggingface.co/datasets/newgenai79/testing/resolve/main/women_with_hat.png"
).convert("RGB")
prompt = "Remove the hat"
image = pipeline(
image=image,
prompt=prompt,
guidance_scale=2.5
).images[0]
image.save("flux-kontext-dev_working.png")
Output image (1024 x 1024)

Not working
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
pipeline = FluxKontextPipeline.from_pretrained(
"black-forest-labs/FLUX.1-Kontext-dev",
torch_dtype=torch.bfloat16
)
pipeline.enable_sequential_cpu_offload()
image = load_image(
"https://huggingface.co/datasets/newgenai79/testing/resolve/main/women_with_hat.png"
).convert("RGB")
prompt = "Remove the hat"
image = pipeline(
image=image,
prompt=prompt,
width=832,
height=1216,
guidance_scale=2.5
).images[0]
image.save("flux-kontext-dev2.png")
Output image (832 x 1232)
Generation height
and width
have been adjusted to 1232 and 832 to fit the model requirements.

Logs
Not required
System Info
latest from source
Who can help?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working