Skip to content

Fix black image output in QwenImageEdit docstring#13820

Open
Praanjaljain29 wants to merge 1 commit into
huggingface:mainfrom
Praanjaljain29:main
Open

Fix black image output in QwenImageEdit docstring#13820
Praanjaljain29 wants to merge 1 commit into
huggingface:mainfrom
Praanjaljain29:main

Conversation

@Praanjaljain29
Copy link
Copy Markdown

@Praanjaljain29 Praanjaljain29 commented May 28, 2026

Fixes #13819

What does this PR do?

This fixes a bug in the QwenImageEditPipeline documentation snippet where users were getting a black image output.

Because the pipeline was initialized in torch.bfloat16, the AutoencoderKL (VAE) mathematically overflows during the decode step, resulting in NaN values that the image processor converts to black pixels.

This PR adds pipe.vae.to(torch.float32) to the docstring example to prevent the overflow and ensure proper image generation.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@yiyixuxu @patrickvonplaten

Fixes huggingface#13819 by upcasting the VAE to torch.float32 before decoding to prevent half-precision overflow.
@github-actions github-actions Bot added size/S PR with diff < 50 LOC fixes-issue pipelines and removed size/S PR with diff < 50 LOC fixes-issue labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Black image when running QwenImageEdit snippet from docs

1 participant