Repository navigation
Feature/qwenimage21 modular - #14820
lucasruan1618 wants to merge 2 commits into
Conversation
|
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 |
|
Hello @lucasruan1618, thanks! |
Thanks @SamuelTallet! I've linked the PR to #14832. |
|
I noticed that #14976 has been merged. Thanks for the work on the Qwen-Image 2.1 modular pipeline! My PR #14820 also includes mask-based inpainting with support for multiple reference images, which isn't covered by #14976. Would you be interested in adding this feature? I'd be happy to adapt the inpainting implementation on top of the newly merged pipeline and submit it as a separate PR if preferred. Thanks! |
[Modular] Support Qwen-Image 2.1 generation and multi-reference inpainting
What does this PR do?
Fixes #14832
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.
Before submitting
self-reviewskill on the diff?Who can review?