-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat: add JoyImage edit plus #14032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add JoyImage edit plus #14032
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
a082315
feat: add image edit plus
d6375a8
refactor: remove debug code
885186a
fix: address review issues for JoyImage Edit Plus
aa2f563
fix: add missing newline at end of pipeline_output.py
8a911e5
fix: add missing newline at end of pipeline_output.py
1344fd0
doc: add joyimage-edit-plus doc
53d0b33
refactor: update code format
4f6cb76
refactor: update code formate
d63e322
refactor: merge edit-plus conversion script into convert_joyimage_edi…
f170222
revert: remove unnecessary attention_mask change from transformer_joy…
b653dc4
Merge branch 'main' into add-joyimage-edit-plus
dg845 31421c1
Apply style fixes
github-actions[bot] 33f550d
fix: remove stale Copied-from annotations that diverged from source
2612cb6
Merge branch 'main' into add-joyimage-edit-plus
dg845 ac7a4b6
fix: address CI check failures for edit-plus PR
46bb713
Merge branch 'main' into add-joyimage-edit-plus
tangyanf 3fa516a
fix: use VAE dtype instead of float32 cast in edit-plus pipeline
1701f61
refactor: address dg845 review comments on edit-plus
6cbdd17
fix: guard against division-by-zero in CFG norm rescaling
cd1328f
Merge branch 'main' into add-joyimage-edit-plus
tangyanf da5c16c
Merge branch 'main' into add-joyimage-edit-plus
dg845 87920e8
style: run ruff format on edit-plus pipeline
4e93efc
Merge branch 'main' into add-joyimage-edit-plus
tangyanf 8822e45
Merge branch 'main' into add-joyimage-edit-plus
dg845 967a4ba
refactor: address dg845 second-round review comments
5a831a3
Merge branch 'main' into add-joyimage-edit-plus
tangyanf 1be91a0
Merge branch 'main' into add-joyimage-edit-plus
dg845 c9a6f17
Apply style fixes
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
docs/source/en/api/models/transformer_joyimage_edit_plus.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <!--Copyright 2025 The HuggingFace Team. All rights reserved. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations under the License. | ||
| --> | ||
|
|
||
| # JoyImageEditPlusTransformer3DModel | ||
|
|
||
| The model can be loaded with the following code snippet. | ||
|
|
||
| ```python | ||
| from diffusers import JoyImageEditPlusTransformer3DModel | ||
|
|
||
| transformer = JoyImageEditPlusTransformer3DModel.from_pretrained("jdopensource/JoyAI-Image-Edit-Plus-Diffusers", subfolder="transformer", torch_dtype=torch.bfloat16) | ||
| ``` | ||
|
|
||
| ## JoyImageEditPlusTransformer3DModel | ||
|
|
||
| [[autodoc]] JoyImageEditPlusTransformer3DModel | ||
|
|
||
| ## Transformer2DModelOutput | ||
|
|
||
| [[autodoc]] models.modeling_outputs.Transformer2DModelOutput |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <!--Copyright 2025 The HuggingFace Team. All rights reserved. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations under the License. | ||
| --> | ||
|
|
||
| # JoyAI-Image-Edit-Plus | ||
|
|
||
| [JoyAI-Image](https://github.com/jd-opensource/JoyAI-Image) is a unified multimodal foundation model for image understanding, text-to-image generation, and instruction-guided image editing. It combines an 8B Multimodal Large Language Model (MLLM) with a 16B Multimodal Diffusion Transformer (MMDiT). | ||
|
|
||
| JoyAI-Image-Edit-Plus is a multi-image instruction-guided editing model that accepts **multiple reference images** and a text instruction to generate a new image that combines elements from the references according to the instruction. It supports 1–5 reference images per sample. | ||
|
|
||
| | Model | Description | Download | | ||
| |:-----:|:-----------:|:--------:| | ||
| | JoyAI-Image-Edit-Plus | Multi-image instruction-guided editing with element composition from multiple references | [Hugging Face](https://huggingface.co/jdopensource/JoyAI-Image-Edit-Plus-Diffusers) | | ||
|
|
||
| ```python | ||
| import torch | ||
| from PIL import Image | ||
| from diffusers import JoyImageEditPlusPipeline | ||
|
|
||
| pipeline = JoyImageEditPlusPipeline.from_pretrained( | ||
| "jdopensource/JoyAI-Image-Edit-Plus-Diffusers", torch_dtype=torch.bfloat16 | ||
| ) | ||
| pipeline.to("cuda") | ||
|
|
||
| images = [ | ||
| Image.open("reference_0.png").convert("RGB"), | ||
| Image.open("reference_1.png").convert("RGB"), | ||
| ] | ||
|
|
||
| target_h, target_w = pipeline.vae_image_processor.get_default_height_width(images[-1]) | ||
|
|
||
| output = pipeline( | ||
| images=images, | ||
| prompt="Combine the person from the second image with the scene from the first image.", | ||
| negative_prompt="low quality, blurry, deformed", | ||
| height=target_h, | ||
| width=target_w, | ||
| num_inference_steps=30, | ||
| guidance_scale=4.0, | ||
| generator=torch.Generator("cuda").manual_seed(42), | ||
| ).images[0] | ||
| output.save("joyimage_edit_plus_output.png") | ||
| ``` | ||
|
|
||
| ## JoyImageEditPlusPipeline | ||
|
|
||
| [[autodoc]] JoyImageEditPlusPipeline | ||
| - all | ||
| - __call__ | ||
|
|
||
| ## JoyImageEditPlusPipelineOutput | ||
|
|
||
| [[autodoc]] pipelines.joyimage.pipeline_output.JoyImageEditPlusPipelineOutput | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.