Skip to content

docs(flux2): clarify image= is reference conditioning, not img2img#13557

Open
NazarKozak wants to merge 1 commit intohuggingface:mainfrom
NazarKozak:docs/flux2-image-arg-clarification
Open

docs(flux2): clarify image= is reference conditioning, not img2img#13557
NazarKozak wants to merge 1 commit intohuggingface:mainfrom
NazarKozak:docs/flux2-image-arg-clarification

Conversation

@NazarKozak
Copy link
Copy Markdown

@NazarKozak NazarKozak commented Apr 25, 2026

What does this PR do?

The image= parameter on Flux2Pipeline and Flux2KleinPipeline is currently described as a "starting point", which mirrors the SD/Flux.1 img2img wording:

Image, numpy array or tensor representing an image batch to be used as the starting point. […] It can also accept image latents as image, but if passing latents directly it is not encoded again.

Flux.2 actually encodes reference images as additional attention conditioning tokens — there's no noisy-latent init, and so no strength parameter. The existing wording is easy to misread when porting code from StableDiffusionImg2ImgPipeline, FluxImg2ImgPipeline, or FluxKontextInpaintPipeline, all of which legitimately accept strength.

We had a production serving stack pass strength= alongside image= based on the existing wording and crashed with:

TypeError: Flux2Pipeline.__call__() got an unexpected keyword argument 'strength'

Changes

  • Rewrite the image= docstring on Flux2Pipeline.__call__ and Flux2KleinPipeline.__call__ to make it explicit that this is reference conditioning, not img2img, and that there is no strength knob.
  • Add a short ## Reference conditioning vs. img2img callout to docs/source/en/api/pipelines/flux2.md distinguishing the two modes, mentioning Flux2KleinInpaintPipeline as the right pipeline if you actually do need a strength-style noisy-latent init.

Flux2KleinKVPipeline's docstring already correctly describes reference conditioning, so no change there. Flux2KleinInpaintPipeline does take strength and is left as-is.

Out of scope (happy to add as a follow-up)

A small defensive check inside __call__ that intercepts unknown img2img kwargs and raises a clear TypeError pointing at this section of the docs, e.g.:

if "strength" in kwargs:
    raise TypeError(
        "Flux2Pipeline does not support `strength`. Flux.2 uses reference "
        "conditioning via `image=`, not noisy-latent img2img. See "
        "https://huggingface.co/docs/diffusers/api/pipelines/flux2 ."
    )

Left out of this PR to keep it docs-only; happy to push as a second commit if maintainers prefer.

Behavioral change

None — docs only.

Fixes # (no related issue — surfaced in production)

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 or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? (N/A — docs only)

Who can review?

Docs: @stevhliu @sayakpaul

@github-actions github-actions Bot added documentation Improvements or additions to documentation pipelines size/S PR with diff < 50 LOC labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pipelines size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant