fix(flux): tighten check_inputs validation#13955
Open
akshan-main wants to merge 1 commit into
Open
Conversation
…olnet img2img dims, redux scales
Contributor
|
Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
sayakpaul
reviewed
Jun 15, 2026
| raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}") | ||
|
|
||
| if height % self.vae_scale_factor * 2 != 0 or width % self.vae_scale_factor * 2 != 0: | ||
| if height % (self.vae_scale_factor * 2) != 0 or width % (self.vae_scale_factor * 2) != 0: |
Member
There was a problem hiding this comment.
What value is this adding though?
Comment on lines
+494
to
+501
| if prompt_embeds is not None and negative_prompt_embeds is not None: | ||
| if prompt_embeds.shape != negative_prompt_embeds.shape: | ||
| raise ValueError( | ||
| "`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but" | ||
| f" got: `prompt_embeds` {prompt_embeds.shape} != `negative_prompt_embeds`" | ||
| f" {negative_prompt_embeds.shape}." | ||
| ) | ||
|
|
Member
There was a problem hiding this comment.
I think this should also be checked when do_true_cfg is True? Otherwise, it's not used right?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Addresses part of the flux review (#13584) - three input-validation gaps in the flux pipelines:
FluxPipeline/FluxKontextPipelineacceptednegative_prompt_embedswith a different shape thanprompt_embeds. Added the shape check the img2img/inpaint variants already have (propagated to kontext via# Copied from).FluxControlNetImg2ImgPipelinecheckedheight % self.vae_scale_factor * 2, which parses as(height % vae_scale_factor) * 2, so invalid sizes like 72 passed. Added the parentheses to match every other flux pipeline.FluxPriorReduxPipelineonly validated scale length for list images and ignoredpooled_prompt_embeds_scale. Now computes the image batch size for tensors too and validates both scales.Verified each finding's repro now raises/flags, and that matching/valid inputs still pass.
Before submitting
Who can review?
@hlky @sayakpaul @yiyixuxu