Skip to content

Conversation

@preetam1407
Copy link

Fixes #12755.

This PR documents the expected shape of the latents argument in Flux2Pipeline.__call__.

For the default AutoencoderKLFlux2 VAE used by FLUX.2, the pipeline first applies 8× spatial compression in the VAE,
and then a 2×2 patch packing step in the pipeline. This results in:

  • an effective 16× downsampling in height and width, and
  • 4× more channels in the latent space.

The expected shape for user-provided latents is therefore:

(batch_size, 128, height // 16, width // 16)

where height and width are the requested output image size. Passing latents with a different shape leads to shape
mismatches inside the VAE and transformer.

Tests

  • Docs-only change; no functional behavior modified.
  • Verified that providing latents of shape (1, 128, H // 16, W // 16) runs end-to-end with the FLUX.2-dev checkpoint.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Jan 9, 2026
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

thanks!

@yiyixuxu
Copy link
Collaborator

can you run make fix-copies?

@yiyixuxu
Copy link
Collaborator

@bot /style

@yiyixuxu yiyixuxu removed the stale Issues that haven't received updates label Jan 10, 2026
@github-actions
Copy link
Contributor

Style fix is beginning .... View the workflow run here.

@HuggingFaceDocBuilderDev

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.

@preetam1407 preetam1407 force-pushed the docs/flux2-latents-shape branch from 543a4b3 to a530e7d Compare January 10, 2026 19:33
@preetam1407 preetam1407 requested a review from yiyixuxu January 10, 2026 19:37
@preetam1407 preetam1407 force-pushed the docs/flux2-latents-shape branch from a530e7d to f8f8d9d Compare January 10, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flux 2: The shape of the latent argument is undocumented

3 participants