Feature/qwenimage21 modular - #14820
Open
lucasruan1618 wants to merge 2 commits into
Open
lucasruan1618 wants to merge 2 commits into
lucasruan1618 wants to merge 2 commits into
Conversation
Contributor
|
Hi @lucasruan1618, 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. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
Contributor
|
Hello @lucasruan1618, thanks! |
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.
[Modular] Support Qwen-Image 2.1 generation and multi-reference inpainting
What does this PR do?
Adds
QwenImage21ModularPipelineusing the releasedQwen/Qwen-Image-2.1checkpoint. The workflow is selected from the supplied inputs:imageruns image-conditioned generation and accepts one image or a flat list.imageandmask_imagerun single-source inpainting.reference_imagesruns inpainting with additional visual references.The source is image 1; references follow in the supplied order. Both the text encoder and VAE encode these conditions. Only the source receives a mask. White mask pixels repaint; black pixels restore source latents after each denoising step.
The implementation separates image preparation, text/VAE encoding, denoise preparation, denoising, and decoding into reusable blocks. It uses Diffusers guiders and generation-local KV caches. Named workflows are
text2image,image_conditioned, andinpainting.The existing transformer, VAE, and native pipeline implementation are unchanged. A registry entry for the existing native pipeline enables modular loading from the published checkpoint metadata.
Text2Img
Inpainting with one image
Using the loaded pipeline and settings above:
Multi-image editing
For unmasked editing, pass the source and references together through
image. Their list order is also their imagenumber in the prompt:
Native and modular decoded outputs match exactly for this three-image edit.
Inpainting with multiple references
Pretrained test results
Qwen/Qwen-Image-2.1, revisionb3179ad355be050328e483a9dfdd9e60cd62adfa.(128, 32)through(384, 480); identical source, mask, and seed for the single-source and multi-reference cases. Their prompts differ to describe the references.Native and modular pipelines share the same loaded model components and use separate equivalent schedulers. Parity compares decoded floating-point arrays before PNG quantization.
Self-review
No unresolved blocking implementation issues were found in the completed review against the repository guides. The review checked declared block inputs/outputs, workflow selection and loading, component reuse, guidance, cache lifecycle, tests, and documentation.
Corrections made during review include moving source encoding into its own block, adding named-workflow lookup, rejecting references without an inpainting mask, and aligning the tiny scheduler fixture with the release. All new helpers have active call paths. The temporary pre-normalization text-encoder hook follows the native implementation and is removed in
finally; future changes should track that implementation.Verdict: ready for human review, with the limitations above. AI assisted the implementation and this draft. Human contributor declarations and approval of the exact PR wording remain for the author to complete before posting.
Who can review?