-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Add GLIGEN Text Image implementation #4777
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0c48be0
Add GLIGEN Text Image implementation
tuanh123789 96aa4db
add style transfer from image
tuanh123789 15f098c
fix check_repository_consistency
tuanh123789 26f6f19
add convert script GLIGEN model to Diffusers
tuanh123789 d91877a
rename attention type
tuanh123789 bd350e2
fix style code
tuanh123789 fae1da5
remove PositionNetTextImage
tuanh123789 834acfc
Revert "fix check_repository_consistency"
tuanh123789 8ad2234
change attention type name
tuanh123789 4c17bdc
update docs for GLIGEN
tuanh123789 6daa59b
change examples with hf-document-image
tuanh123789 d9d063a
fix style
tuanh123789 81a2734
Merge branch 'main' into gligen_text_image
tuanh123789 567b00b
add CLIPImageProjection for GLIGEN
tuanh123789 bf3b58f
Add new encode_prompt, load project matrix in pipe init
tuanh123789 987e6ba
move CLIPImageProjection to stable_diffusion
tuanh123789 92d942f
add comment
tuanh123789 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,10 +42,12 @@ class StableDiffusionPipelineOutput(BaseOutput): | |
| except OptionalDependencyNotAvailable: | ||
| from ...utils.dummy_torch_and_transformers_objects import * # noqa F403 | ||
| else: | ||
| from .clip_image_project_model import CLIPImageProjection | ||
|
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. ok! |
||
| from .pipeline_cycle_diffusion import CycleDiffusionPipeline | ||
| from .pipeline_stable_diffusion import StableDiffusionPipeline | ||
| from .pipeline_stable_diffusion_attend_and_excite import StableDiffusionAttendAndExcitePipeline | ||
| from .pipeline_stable_diffusion_gligen import StableDiffusionGLIGENPipeline | ||
| from .pipeline_stable_diffusion_gligen_text_image import StableDiffusionGLIGENTextImagePipeline | ||
| from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline | ||
| from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline | ||
| from .pipeline_stable_diffusion_inpaint_legacy import StableDiffusionInpaintPipelineLegacy | ||
|
|
||
29 changes: 29 additions & 0 deletions
29
src/diffusers/pipelines/stable_diffusion/clip_image_project_model.py
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 2023 The GLIGEN Authors and 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. | ||
|
|
||
| from torch import nn | ||
|
|
||
| from ...configuration_utils import ConfigMixin, register_to_config | ||
| from ...models.modeling_utils import ModelMixin | ||
|
|
||
|
|
||
| class CLIPImageProjection(ModelMixin, ConfigMixin): | ||
| @register_to_config | ||
| def __init__(self, hidden_size: int = 768): | ||
| super().__init__() | ||
| self.hidden_size = hidden_size | ||
| self.project = nn.Linear(self.hidden_size, self.hidden_size, bias=False) | ||
|
|
||
| def forward(self, x): | ||
| return self.project(x) |
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.
Cool!