Repository navigation
FLUX.3: match the released BFL reference image sizing - #15073
Merged
Merged
Conversation
A single reference is kept whole: downscaled so its padded canvas fits under 4 MP, reflect-padded to the token grid (`resize_mode="fill"` of the FLUX.3 image processor), and cropped back on output. Several references are fitted under 1 MP each. The default output size follows the first reference. Fixes #15068 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
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. |
`preprocess` takes only the image and `resize_mode`: "fill" downscales the reference so that its canvas fits under 4 megapixels and reflect-pads it to the canvas, "crop" fits it under 1 megapixel and center-crops it to the grid. The process-images block only picks the mode. Fill is a pure pad, like crop is a pure crop, and the crop-back box is read from the preprocessed tensor. The flags of the base processor are fixed; only the VAE scale factor and latent channels remain configurable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
sayakpaul
approved these changes
Oct 19, 2026
| canvas_height, canvas_width = self._get_canvas_height_width(height, width, max_side=max_side) | ||
| if canvas_height * canvas_width <= target_area: | ||
| break | ||
| scale *= 0.995 |
Member
There was a problem hiding this comment.
Could benefit from a reference / explainer.
| # several references: the first one's size, each cropped to the grid | ||
| assert pipe(**inputs, image=self.get_reference_images(sizes=((62, 46), (32, 32))), output="images").shape[ | ||
| -2: | ||
| ] == (32, 48) |
Member
There was a problem hiding this comment.
Ah so, this is happening because with multiple references, preprocessing center-crops each image to multiples of 16.
For the first reference, (width, height) = (62, 46) becomes:
- Width: 62 // 16 * 16 = 48
- Height: 46 // 16 * 16 = 32
I thought it would be (46, 62) but now it makes sense.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Fixes #15068
this PR matches how BFL prepares reference images and derive the default output size from the reference
Default output size
before, when you did not pass
height/width, the output defaulted to about 1024 x 1024 pixels of area in the shape of the reference, whatever the reference's size, so a 1920 x1080 input came back as 1376 x 768. Now the output defaults to the exact size of the reference. The model keeps everything it is not asked to change where it was, which makes edits much more precise. Passingheight/widthworks as before.Reference sizing.
height/width, nothing is cut back.)Flux3ImageProcessor.preprocess, which also returns the box to cut the output back to, applied inpostprocess. The pipeline block only chooses between the two cases.With the default output size, images under 1024 x 1024 cost the same or less than before. Images between 1024 x 1024 and 2048 x 2048 produce a larger output than before, so they take more time and memory (up to about 1.5x). Larger images are much cheaper than before, because the old limit was 4096 x 4096.
see more details (include 3 examples https://claude.ai/artifact/KBEVcvLyjqs8DpisezaekF)