Skip to content

Fix missing latents_bn_std dtype cast in VAE normalization#13299

Merged
sayakpaul merged 5 commits into
huggingface:mainfrom
adi776borate:fix/flux2-vae-device-casting
May 1, 2026
Merged

Fix missing latents_bn_std dtype cast in VAE normalization#13299
sayakpaul merged 5 commits into
huggingface:mainfrom
adi776borate:fix/flux2-vae-device-casting

Conversation

@adi776borate

Copy link
Copy Markdown
Contributor

What does this PR do?

Follow up to #13050

This PR addresses an unintentional dtype/device mismatch during the VAE image encoding step in Flux2 pipelines.

Currently, inside _encode_vae_image, latents_bn_mean is explicitly cast to match image_latents, but latents_bn_std is left in its default buffer state.

Before submitting

Who can review?

@asomoza
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@yiyixuxu yiyixuxu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@github-actions github-actions Bot added pipelines size/S PR with diff < 50 LOC labels Apr 13, 2026
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@adi776borate

Copy link
Copy Markdown
Contributor Author

Thanks for the review! It should be ready to merge whenever convenient.

@iwr-redmond

iwr-redmond commented Apr 17, 2026

Copy link
Copy Markdown

@asomoza @yiyixuxu what else needs to be done prior to merging this PR? It is a blocker for #13050.

@asomoza

asomoza commented Apr 17, 2026

Copy link
Copy Markdown
Member

@iwr-redmond we merged the other PR so its not a blocker anymore, now this one needs to be updated

@github-actions github-actions Bot added size/S PR with diff < 50 LOC and removed size/S PR with diff < 50 LOC labels Apr 18, 2026
@github-actions github-actions Bot added size/S PR with diff < 50 LOC and removed size/S PR with diff < 50 LOC labels Apr 18, 2026
@asomoza asomoza mentioned this pull request May 1, 2026
6 tasks

@dg845 dg845 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions github-actions Bot added size/S PR with diff < 50 LOC and removed size/S PR with diff < 50 LOC labels May 1, 2026
@sayakpaul sayakpaul merged commit 42a46e4 into huggingface:main May 1, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipelines size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants