Repository navigation
feat(models): add Qwen-Image-2.1 edits from reference images - #9787
Open
Pfannkuchensack wants to merge 16 commits into
Open
Pfannkuchensack wants to merge 16 commits into
Pfannkuchensack wants to merge 16 commits into
Conversation
Adds the qwen-image-2-1 base (Base/Turbo) with Diffusers, single-file and GGUF transformers, the RGBA VAE and webv2 generate/canvas graphs. Bit-identical to QwenImage21Pipeline; img2img starts by noise level, large encodes and decodes tile automatically, unsupported quantizations are refused at install. Shares the Qwen3-VL 8B encoder starter with Ideogram 4 and documents the model.
Pfannkuchensack
marked this pull request as draft
October 10, 2026 19:39
6 of 7 tasks
…e torchao files Denormalize latents and map the decode to pixels in the VAE's dtype, as QwenImage21Pipeline does. Load the bundled VAE at the configured precision (never float16); scale the denoise estimate with the dtype. Refuse torchao-quantized single files (unsloth's FP8 build) at install; fix the Turbo fixture's scheduler config.
Pfannkuchensack
force-pushed
the
feat/qwen-image-2-1-edit
branch
from
October 10, 2026 23:56
c529c42 to
3545331
Compare
1 task done
# Conflicts: # docs/src/content/docs/Users Guide/03.Models/02.model-families.mdx # docs/src/content/docs/start-here/system-requirements.mdx # invokeai/backend/model_manager/load/model_loaders/ideogram4.py # invokeai/frontend/api/schema.ts
The Diffusers model's encoder keeps the Qwen3-VL vision tower; references feed both prompts and, as latents, the denoise node. References are matched to the prompt's image slots by grid, and the prefix cache is skipped when it would not fit. webv2 offers references on Diffusers models only and blocks Invoke while a standalone encoder replaces the one that reads them.
The encoder's attention grows with the square of the sequence; four references need ~5.4 GiB beyond its weights. The node counts the tokens before encoding and reserves that room, so the cache offloads instead of the driver.
Pfannkuchensack
force-pushed
the
feat/qwen-image-2-1-edit
branch
from
October 11, 2026 00:27
3545331 to
7e7f757
Compare
Pfannkuchensack
marked this pull request as ready for review
October 11, 2026 01:01
# Conflicts: # docs/src/content/docs/configuration/Optimization/low-vram-mode.mdx # invokeai/frontend/api/schema.ts # tests/app/invocations/test_frontend_graph_node_types.py
… to the format page Base picks its start step by strength like Qwen-Image and diffusers' img2img; Turbo keeps noise-level selection. List Qwen-Image-2.1 on the Model Format Support page, and drop the builder's dead component checks. Test the denoise passes the compute dtype's width, and the encoder edge's source field.
Cover nearest-step rounding on Base, a guidance list shifted by a step on Turbo, and the bf16 width. Docs: Turbo's start in plain noise-level terms; the 2.1 VAE among those refusing quantized files.
It shared Qwen Image's cyan, so the two base badges rendered the same foreground. Adds a deeper cyan (aqua), related as FLUX.1/FLUX.2 are, and holds it to the badge contrast bar.
This branch has not been deployed
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.
Summary
Adds edits from reference images to Qwen-Image-2.1 (up to 4). The prompt says what to do with the references, for example put the jacket from the first image on the person in the second.
Stacked on #9784. This PR's own change is the last commit; the first one is #9784.
The model reads each reference twice, at the same size (about 1 MP at its aspect ratio, on the 32 px grid):
<|image_pad|>slots, 2×2 latents per slot. Alpha is kept, and the latents are normalized in the VAE dtype, as the pipeline does.Backend
qwen_image_2_1_text_encodertakesreference_images. It stores the slot mask and each reference's slot grid in the conditioning.qwen_image_2_1_i2lgains areferencemode. Its preprocessing is bit-identical to the pipeline'sVaeImageProcessor.qwen_image_2_1_denoisetakesreference_latents. It checks each reference against the prompt's slot grid, so a wrong order, count or size fails before the transformer loads, and it requires the negative prompt to be encoded with the same references.FeaturesFacet.reference_images_require_format, analogous toreference_images_require_variant. Qwen-Image-2.1 declares"diffusers".webv2
qwen_image_2_1_reference_image.Docs: the "Reference images" section on the Qwen-Image-2.1 page, the generate-panel and model-families rows, the recall API, and the integration guide.
Related Issues / Discussions
Part of #9594. Depends on #9784.
QA Instructions
pnpm lintpasses. vitest: 10077 passed; 3 failures are locale-dependent tests that fail on a German-locale machine, unrelated to this change.VaeImageProcessor;reserve_vram_gb: 1):QwenImage21Pipeline; the edited image matches it at 45.6 dB, the rest being cuDNN's choice of convolution kernels for the reference encode. The model card's yacht-sketch edit gives a clean photorealistic result.Review
All material findings were resolved, with regression tests:
Found in GPU testing and fixed, with a regression test: the encoder node reserved no room for the references' attention (above).
Remaining limitation: two references of identical size in swapped order cannot be told apart.
Compatibility / Rollout
openapi.jsonandschema.tsare regenerated. The changes are additive: new node fields and the new capability field.reference_images_require_formatis new and null for every other base.Checklist
What's Newcopy (if doing a release after this PR)