-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Support LLaDa-Image #14815
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
Open
lucasruan1618
wants to merge
3
commits into
huggingface:main
Choose a base branch
from
lucasruan1618:add-llada-image
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,240
−2
Open
Support LLaDa-Image #14815
Changes from all commits
Commits
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
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,23 @@ | ||
| # LLaDA-Image | ||
|
|
||
| The LLaDA-Image model family combines a denoising transformer with a QueryFormer, text projection model, and SigVQ | ||
| image tokenizer. Together, these components support text-to-image generation, VQ-conditioned generation, and | ||
| instruction-guided image editing. | ||
|
|
||
| The original code and checkpoints are available in the [LLaDA-Image repository](https://github.com/inclusionAI/LLaDA-Image). | ||
|
|
||
| ## LLaDAImageTransformer2DModel | ||
|
|
||
| [[autodoc]] LLaDAImageTransformer2DModel | ||
|
|
||
| ## LLaDAImageQueryFormerModel | ||
|
|
||
| [[autodoc]] LLaDAImageQueryFormerModel | ||
|
|
||
| ## LLaDAImageTextProjectionModel | ||
|
|
||
| [[autodoc]] LLaDAImageTextProjectionModel | ||
|
|
||
| ## LLaDAImageSigVQModel | ||
|
|
||
| [[autodoc]] LLaDAImageSigVQModel |
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,57 @@ | ||||||||||||||||||||||||||||||
| # LLaDA-Image | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing the Apache license header comment that every other page under
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [LLaDA-Image](https://huggingface.co/inclusionAI/LLaDA-Image) is a unified image generation and editing model. The | ||||||||||||||||||||||||||||||
| same pipeline supports text-to-image generation, VQ-conditioned generation, and instruction-guided editing with a | ||||||||||||||||||||||||||||||
| reference image. The Base checkpoint is designed for 50 sampling steps, while | ||||||||||||||||||||||||||||||
| [LLaDA-Image-Turbo](https://huggingface.co/inclusionAI/LLaDA-Image-Turbo) is distilled for 4 steps. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| The checkpoint includes a custom LLaDA2 text encoder, so pass `trust_remote_code=True` when loading it. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```python | ||||||||||||||||||||||||||||||
| import torch | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| from diffusers import LLaDAImagePipeline | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| pipe = LLaDAImagePipeline.from_pretrained( | ||||||||||||||||||||||||||||||
| "inclusionAI/LLaDA-Image", | ||||||||||||||||||||||||||||||
| dtype=torch.bfloat16, | ||||||||||||||||||||||||||||||
| trust_remote_code=True, | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
| pipe.enable_model_cpu_offload() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| image = pipe( | ||||||||||||||||||||||||||||||
| prompt="A cinematic photograph of a red fox standing in fresh snow", | ||||||||||||||||||||||||||||||
| height=1024, | ||||||||||||||||||||||||||||||
| width=1024, | ||||||||||||||||||||||||||||||
| num_inference_steps=50, | ||||||||||||||||||||||||||||||
| guidance_scale=5.0, | ||||||||||||||||||||||||||||||
| generator=torch.Generator("cuda").manual_seed(42), | ||||||||||||||||||||||||||||||
| ).images[0] | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| For image editing, pass a reference image and select the editing mode. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```python | ||||||||||||||||||||||||||||||
| from diffusers.utils import load_image | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| reference_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") | ||||||||||||||||||||||||||||||
| image = pipe( | ||||||||||||||||||||||||||||||
| prompt="Turn it into a watercolor painting", | ||||||||||||||||||||||||||||||
| image=reference_image, | ||||||||||||||||||||||||||||||
| generation_mode="editing", | ||||||||||||||||||||||||||||||
| height=1024, | ||||||||||||||||||||||||||||||
| width=1024, | ||||||||||||||||||||||||||||||
| num_inference_steps=50, | ||||||||||||||||||||||||||||||
| guidance_scale=5.0, | ||||||||||||||||||||||||||||||
| ).images[0] | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## LLaDAImagePipeline | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [[autodoc]] LLaDAImagePipeline | ||||||||||||||||||||||||||||||
| - all | ||||||||||||||||||||||||||||||
| - call | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## LLaDAImagePipelineOutput | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| [[autodoc]] pipelines.LLaDAImagePipelineOutput | ||||||||||||||||||||||||||||||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entries in the models section are titled by class name (
LatteTransformer3DModel,LongCatImageTransformer2DModel,Krea2Transformer2DModel).LLaDA-Imagehere also collides with the identically titled pipeline entry at line 623, making the two hard to tell apart in the sidebar.