Skip to content

t2i pipeline #3932

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 10 commits into from
Jul 17, 2023
Merged

Conversation

williamberman
Copy link
Contributor

@williamberman williamberman commented Jul 3, 2023

rebased and refactored from #2555

tl;dr

  1. I refactored the main adapter class into the separate "light adapter" and "full adapters" from the original implementation and wrote separate block types for each. The result has little to no conditionals and avoids the large resnet class.
  2. I removed all un-used arguments that could just be left as defaults.
  3. I fixed up the conversion script so it directly writes out the full diffusers style checkpoint - as was it was writing out torch weights and required some additional leg work to get the right config for the main class

TODO

  • Upload new checkpoints to the diffusers org
  • Go over tests
  • Fix docs

Converting

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_canny_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_canny_sd14v1.converted \
    --in_channels=1

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_canny_sd15v2.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_canny_sd15v2.converted \
    --in_channels=1

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_depth_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_depth_sd14v1.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_depth_sd15v2.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_depth_sd15v2.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_keypose_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_keypose_sd14v1.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_openpose_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_openpose_sd14v1.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_seg_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_seg_sd14v1.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_sketch_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_sketch_sd14v1.converted \
    --in_channels=1

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_sketch_sd15v2.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_sketch_sd15v2.converted \
    --in_channels=1

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_zoedepth_sd15v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_zoedepth_sd15v1.converted \
    --in_channels=3

python scripts/convert_original_t2i_adapter.py \
    --checkpoint_path ../T2I-Adapter-src/models/t2iadapter_color_sd14v1.pth \
    --output_path ../T2I-Adapter-converted/t2iadapter_color_sd14v1.converted \
    --is_adapter_light

uploaded models

https://huggingface.co/diffusers/t2iadapter_canny_sd14v1
https://huggingface.co/diffusers/t2iadapter_canny_sd15v2
https://huggingface.co/diffusers/t2iadapter_color_sd14v1
https://huggingface.co/diffusers/t2iadapter_depth_sd14v1
https://huggingface.co/diffusers/t2iadapter_depth_sd15v2
https://huggingface.co/diffusers/t2iadapter_keypose_sd14v1
https://huggingface.co/diffusers/t2iadapter_openpose_sd14v1
https://huggingface.co/diffusers/t2iadapter_seg_sd14v1
https://huggingface.co/diffusers/t2iadapter_sketch_sd14v1
https://huggingface.co/diffusers/t2iadapter_sketch_sd15v2
https://huggingface.co/diffusers/t2iadapter_zoedepth_sd15v1

@williamberman williamberman force-pushed the will/general-adapter_ branch 3 times, most recently from f61bfdc to 104b077 Compare July 4, 2023 03:02
@williamberman williamberman changed the title Quick implementation of t2i-adapter t2i pipeline Jul 4, 2023
@williamberman williamberman force-pushed the will/general-adapter_ branch from 104b077 to a10e41c Compare July 4, 2023 03:05
@williamberman williamberman marked this pull request as ready for review July 4, 2023 03:07
@williamberman
Copy link
Contributor Author

@HimariO would love your review on this if possible, I tried requesting as a reviewer formally but it wouldn't let me

@williamberman williamberman requested review from pcuenca and yiyixuxu July 4, 2023 03:13
@patrickvonplaten
Copy link
Contributor

@yiyixuxu @sayakpaul could you try to give this PR a review?

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks great to me! Great job!

@patrickvonplaten
Copy link
Contributor

Happy to merge and once the authors get back to us we can transfer the checkpoints

@sayakpaul
Copy link
Member

Happy to merge and once the authors get back to us we can transfer the checkpoints

Since we have approval we can proceed. But I would first recommend adding model cards to all the pipelines and then moving forward. Cc: @williamberman

@williamberman williamberman force-pushed the will/general-adapter_ branch from 560677c to 7f1f5ee Compare July 14, 2023 17:00
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

for x, w, adapter in zip(x_list, adapter_weights, self.adapters):
features = adapter(x)
if accume_state is None:
accume_state = features
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weights don't apply to the first adapter output?

@amrakm
Copy link

amrakm commented Jul 15, 2023

Is this example code still the latest?

from PIL import Image
from diffusers.utils import load_image
import torch
from diffusers import StableDiffusionAdapterPipeline, T2IAdapter

# Load the image
image = load_image("https://huggingface.co/RzZ/sd-v1-4-adapter-color/resolve/main/color_ref.png")

# Create the color palette
color_palette = image.resize((8, 8))
color_palette = color_palette.resize((512, 512), resample=Image.Resampling.NEAREST)

# Initialize the T2IAdapter
adapter = T2IAdapter.from_pretrained("RzZ/sd-v1-4-adapter-color")

# Initialize the StableDiffusionAdapterPipeline
pipe = StableDiffusionAdapterPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    adapter=adapter,
    torch_dtype=torch.float16,
)

# Move the pipeline to the GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
pipe.to(device)

# Generate the output image
out_image = pipe(
    "At night, glowing cubes in front of the beach",
    image=color_palette,
).images[0]

I'm getting this error when I run it:

Cell In[3], line 14
     11 color_palette = color_palette.resize((512, 512), resample=Image.Resampling.NEAREST)
     13 # Initialize the T2IAdapter
---> 14 adapter = T2IAdapter.from_pretrained("RzZ/sd-v1-4-adapter-color")
     16 # Initialize the StableDiffusionAdapterPipeline
     17 pipe = StableDiffusionAdapterPipeline.from_pretrained(
     18     "CompVis/stable-diffusion-v1-4",
     19     adapter=adapter,
     20     torch_dtype=torch.float16,
     21 )

File ~/anaconda3/envs/diff-t2i/lib/python3.10/site-packages/diffusers/models/modeling_utils.py:604, in ModelMixin.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    602 missing_keys = set(model.state_dict().keys()) - set(state_dict.keys())
    603 if len(missing_keys) > 0:
--> 604     raise ValueError(
    605         f"Cannot load {cls} from {pretrained_model_name_or_path} because the following keys are"
    606         f" missing: \n {', '.join(missing_keys)}. \n Please make sure to pass"
    607         " `low_cpu_mem_usage=False` and `device_map=None` if you want to randomly initialize"
    608         " those weights or else make sure your checkpoint file is correct."
    609     )
    610 unexpected_keys = []
    612 empty_state_dict = model.state_dict()

ValueError: Cannot load  from RzZ/sd-v1-4-adapter-color because the following keys are missing: 
 adapter.conv_in.weight, adapter.conv_in.bias, adapter.body.1.resnets.2.block1.bias, adapter.body.2.resnets.3.block1.weight, adapter.body.1.resnets.3.block1.bias, adapter.body.2.resnets.3.block2.weight, adapter.body.1.resnets.0.block1.weight, adapter.body.1.resnets.0.block2.weight, adapter.body.2.in_conv.weight, adapter.body.2.resnets.2.block2.bias, adapter.body.3.resnets.0.block2.bias, adapter.body.3.resnets.3.block1.bias, adapter.body.1.resnets.3.block1.weight, adapter.body.1.resnets.3.block2.weight, adapter.body.3.resnets.0.block2.weight, adapter.body.1.resnets.3.block2.bias, adapter.body.3.resnets.2.block1.weight, adapter.body.1.resnets.2.block1.weight, adapter.body.2.resnets.2.block1.bias, adapter.body.2.resnets.0.block2.weight, adapter.body.1.resnets.1.block2.bias, adapter.body.0.resnets.3.block1.weight, adapter.body.0.resnets.3.block2.bias, adapter.body.2.resnets.0.block2.bias, adapter.body.1.resnets.1.block1.weight, adapter.body.2.in_conv.bias, adapter.body.2.resnets.2.block2.weight, adapter.body.1.resnets.1.block2.weight, adapter.body.3.resnets.2.block1.bias, adapter.body.1.in_conv.weight, adapter.body.3.resnets.3.block1.weight, adapter.body.3.resnets.3.block2.weight, adapter.body.2.resnets.1.block1.bias, adapter.body.2.resnets.3.block2.bias, adapter.body.1.resnets.2.block2.weight, adapter.body.3.resnets.0.block1.weight, adapter.body.3.resnets.1.block1.weight, adapter.body.2.resnets.1.block1.weight, adapter.body.1.resnets.0.block2.bias, adapter.body.0.resnets.2.block1.bias, adapter.body.0.resnets.2.block1.weight, adapter.body.2.resnets.0.block1.weight, adapter.body.3.resnets.0.block1.bias, adapter.body.3.resnets.1.block2.bias, adapter.body.0.resnets.2.block2.weight, adapter.body.1.resnets.0.block1.bias, adapter.body.1.resnets.2.block2.bias, adapter.body.0.resnets.1.block1.bias, adapter.body.0.resnets.0.block2.bias, adapter.body.2.resnets.2.block1.weight, adapter.body.0.resnets.3.block2.weight, adapter.body.0.resnets.1.block2.bias, adapter.body.3.resnets.1.block1.bias, adapter.body.3.resnets.2.block2.bias, adapter.body.2.resnets.1.block2.bias, adapter.body.0.resnets.2.block2.bias, adapter.body.3.resnets.3.block2.bias, adapter.body.0.resnets.0.block2.weight, adapter.body.2.resnets.1.block2.weight, adapter.body.0.resnets.3.block1.bias, adapter.body.0.resnets.0.block1.weight, adapter.body.3.resnets.1.block2.weight, adapter.body.2.resnets.0.block1.bias, adapter.body.1.resnets.1.block1.bias, adapter.body.3.resnets.2.block2.weight, adapter.body.0.resnets.1.block1.weight, adapter.body.0.resnets.0.block1.bias, adapter.body.1.in_conv.bias, adapter.body.0.resnets.1.block2.weight, adapter.body.2.resnets.3.block1.bias. 
 Please make sure to pass `low_cpu_mem_usage=False` and `device_map=None` if you want to randomly initialize those weights or else make sure your checkpoint file is correct.```

@patrickvonplaten
Copy link
Contributor

cc @williamberman can we make sure to add @HimariO here as a co-author as this PR superseeds: #2555

HimariO and others added 7 commits July 17, 2023 11:16
Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix
@williamberman williamberman force-pushed the will/general-adapter_ branch from 7f1f5ee to f706918 Compare July 17, 2023 18:23
@williamberman
Copy link
Contributor Author

Is this example code still the latest?

from PIL import Image
from diffusers.utils import load_image
import torch
from diffusers import StableDiffusionAdapterPipeline, T2IAdapter

# Load the image
image = load_image("https://huggingface.co/RzZ/sd-v1-4-adapter-color/resolve/main/color_ref.png")

# Create the color palette
color_palette = image.resize((8, 8))
color_palette = color_palette.resize((512, 512), resample=Image.Resampling.NEAREST)

# Initialize the T2IAdapter
adapter = T2IAdapter.from_pretrained("RzZ/sd-v1-4-adapter-color")

# Initialize the StableDiffusionAdapterPipeline
pipe = StableDiffusionAdapterPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    adapter=adapter,
    torch_dtype=torch.float16,
)

# Move the pipeline to the GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
pipe.to(device)

# Generate the output image
out_image = pipe(
    "At night, glowing cubes in front of the beach",
    image=color_palette,
).images[0]

I'm getting this error when I run it:

Cell In[3], line 14
     11 color_palette = color_palette.resize((512, 512), resample=Image.Resampling.NEAREST)
     13 # Initialize the T2IAdapter
---> 14 adapter = T2IAdapter.from_pretrained("RzZ/sd-v1-4-adapter-color")
     16 # Initialize the StableDiffusionAdapterPipeline
     17 pipe = StableDiffusionAdapterPipeline.from_pretrained(
     18     "CompVis/stable-diffusion-v1-4",
     19     adapter=adapter,
     20     torch_dtype=torch.float16,
     21 )

File ~/anaconda3/envs/diff-t2i/lib/python3.10/site-packages/diffusers/models/modeling_utils.py:604, in ModelMixin.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    602 missing_keys = set(model.state_dict().keys()) - set(state_dict.keys())
    603 if len(missing_keys) > 0:
--> 604     raise ValueError(
    605         f"Cannot load {cls} from {pretrained_model_name_or_path} because the following keys are"
    606         f" missing: \n {', '.join(missing_keys)}. \n Please make sure to pass"
    607         " `low_cpu_mem_usage=False` and `device_map=None` if you want to randomly initialize"
    608         " those weights or else make sure your checkpoint file is correct."
    609     )
    610 unexpected_keys = []
    612 empty_state_dict = model.state_dict()

ValueError: Cannot load  from RzZ/sd-v1-4-adapter-color because the following keys are missing: 
 adapter.conv_in.weight, adapter.conv_in.bias, adapter.body.1.resnets.2.block1.bias, adapter.body.2.resnets.3.block1.weight, adapter.body.1.resnets.3.block1.bias, adapter.body.2.resnets.3.block2.weight, adapter.body.1.resnets.0.block1.weight, adapter.body.1.resnets.0.block2.weight, adapter.body.2.in_conv.weight, adapter.body.2.resnets.2.block2.bias, adapter.body.3.resnets.0.block2.bias, adapter.body.3.resnets.3.block1.bias, adapter.body.1.resnets.3.block1.weight, adapter.body.1.resnets.3.block2.weight, adapter.body.3.resnets.0.block2.weight, adapter.body.1.resnets.3.block2.bias, adapter.body.3.resnets.2.block1.weight, adapter.body.1.resnets.2.block1.weight, adapter.body.2.resnets.2.block1.bias, adapter.body.2.resnets.0.block2.weight, adapter.body.1.resnets.1.block2.bias, adapter.body.0.resnets.3.block1.weight, adapter.body.0.resnets.3.block2.bias, adapter.body.2.resnets.0.block2.bias, adapter.body.1.resnets.1.block1.weight, adapter.body.2.in_conv.bias, adapter.body.2.resnets.2.block2.weight, adapter.body.1.resnets.1.block2.weight, adapter.body.3.resnets.2.block1.bias, adapter.body.1.in_conv.weight, adapter.body.3.resnets.3.block1.weight, adapter.body.3.resnets.3.block2.weight, adapter.body.2.resnets.1.block1.bias, adapter.body.2.resnets.3.block2.bias, adapter.body.1.resnets.2.block2.weight, adapter.body.3.resnets.0.block1.weight, adapter.body.3.resnets.1.block1.weight, adapter.body.2.resnets.1.block1.weight, adapter.body.1.resnets.0.block2.bias, adapter.body.0.resnets.2.block1.bias, adapter.body.0.resnets.2.block1.weight, adapter.body.2.resnets.0.block1.weight, adapter.body.3.resnets.0.block1.bias, adapter.body.3.resnets.1.block2.bias, adapter.body.0.resnets.2.block2.weight, adapter.body.1.resnets.0.block1.bias, adapter.body.1.resnets.2.block2.bias, adapter.body.0.resnets.1.block1.bias, adapter.body.0.resnets.0.block2.bias, adapter.body.2.resnets.2.block1.weight, adapter.body.0.resnets.3.block2.weight, adapter.body.0.resnets.1.block2.bias, adapter.body.3.resnets.1.block1.bias, adapter.body.3.resnets.2.block2.bias, adapter.body.2.resnets.1.block2.bias, adapter.body.0.resnets.2.block2.bias, adapter.body.3.resnets.3.block2.bias, adapter.body.0.resnets.0.block2.weight, adapter.body.2.resnets.1.block2.weight, adapter.body.0.resnets.3.block1.bias, adapter.body.0.resnets.0.block1.weight, adapter.body.3.resnets.1.block2.weight, adapter.body.2.resnets.0.block1.bias, adapter.body.1.resnets.1.block1.bias, adapter.body.3.resnets.2.block2.weight, adapter.body.0.resnets.1.block1.weight, adapter.body.0.resnets.0.block1.bias, adapter.body.1.in_conv.bias, adapter.body.0.resnets.1.block2.weight, adapter.body.2.resnets.3.block1.bias. 
 Please make sure to pass `low_cpu_mem_usage=False` and `device_map=None` if you want to randomly initialize those weights or else make sure your checkpoint file is correct.```

Ah thank you for catching, updated snippet :)

@williamberman
Copy link
Contributor Author

cc @williamberman can we make sure to add @HimariO here as a co-author as this PR superseeds: #2555

Yep! Already a co-author in the squashed commit history and thanked in docs :)

@williamberman
Copy link
Contributor Author

test failure unrelated

@williamberman williamberman merged commit a0597f3 into huggingface:main Jul 17, 2023
orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* Quick implementation of t2i-adapter

Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix

* fix sample inplace add

* additional_kwargs -> additional_residuals

* move t2i adapter pipeline to own module

* preprocess -> _preprocess_adapter_image

* add TencentArc to license

* fix example code links

* add image converter and fix example doc string

* fix links

* clearer additional residual application

---------

Co-authored-by: HimariO <[email protected]>
orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* Quick implementation of t2i-adapter

Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix

* fix sample inplace add

* additional_kwargs -> additional_residuals

* move t2i adapter pipeline to own module

* preprocess -> _preprocess_adapter_image

* add TencentArc to license

* fix example code links

* add image converter and fix example doc string

* fix links

* clearer additional residual application

---------

Co-authored-by: HimariO <[email protected]>
orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* Quick implementation of t2i-adapter

Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix

* fix sample inplace add

* additional_kwargs -> additional_residuals

* move t2i adapter pipeline to own module

* preprocess -> _preprocess_adapter_image

* add TencentArc to license

* fix example code links

* add image converter and fix example doc string

* fix links

* clearer additional residual application

---------

Co-authored-by: HimariO <[email protected]>
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* Quick implementation of t2i-adapter

Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix

* fix sample inplace add

* additional_kwargs -> additional_residuals

* move t2i adapter pipeline to own module

* preprocess -> _preprocess_adapter_image

* add TencentArc to license

* fix example code links

* add image converter and fix example doc string

* fix links

* clearer additional residual application

---------

Co-authored-by: HimariO <[email protected]>
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* Quick implementation of t2i-adapter

Load adapter module with from_pretrained

Prototyping generalized adapter framework

Writeup doc string for sideload framework(WIP) + some minor update on implementation

Update adapter models

Remove old adapter optional args in UNet

Add StableDiffusionAdapterPipeline unit test

Handle cpu offload in StableDiffusionAdapterPipeline

Auto correct coding style

Update model repo name to "RzZ/sd-v1-4-adapter-pipeline"

Refactor MultiAdapter to better compatible with config system

Export MultiAdapter

Create pipeline document template from controlnet

Create dummy objects

Supproting new AdapterLight model

Fix StableDiffusionAdapterPipeline common pipeline test

[WIP] Update adapter pipeline document

Handle num_inference_steps in StableDiffusionAdapterPipeline

Update definition of Adapter "channels_in"

Update documents

Apply code style

Fix doc typo and merge error

Update doc string and example

Quality of life improvement

Remove redundant code and file from prototyping

Remove unused pageage

Remove comments

Fix title

Fix typo

Add conditioning scale arg

Bring back old implmentation

Offload sideload

Add supply info on document

Update src/diffusers/models/adapter.py

Co-authored-by: Will Berman <[email protected]>

Update MultiAdapter constructor

Swap out custom checkpoint and update pipeline constructor

Update docment

Apply suggestions from code review

Co-authored-by: Will Berman <[email protected]>

Correcting style

Following single-file policy

Update auto size in image preprocess func

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

fix copies

Update adapter pipeline behavior

Add adapter_conditioning_scale doc string

Add the missing doc string

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Fix few bugs from suggestion

Handle L-mode PIL image as control image

Rename to differentiate adapter resblock

Update src/diffusers/models/adapter.py

Co-authored-by: Sayak Paul <[email protected]>

Fix typo

Update adapter parameter name

Update test case and code style

Fix copies

Fix typo

Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_adapter.py

Co-authored-by: Will Berman <[email protected]>

Update Adapter class name

Add checkpoint converting script

Fix style

Fix-copies

Remove dev script

Apply suggestions from code review

Co-authored-by: Patrick von Platen <[email protected]>

Updates for parameter rename

Fix convert_adapter

remove main

fix diff

more

refactoring

more

more

small fixes

refactor

tests

more slow tests

more tests

Update docs/source/en/api/pipelines/overview.mdx

Co-authored-by: Sayak Paul <[email protected]>

add community contributor to docs

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

Update docs/source/en/api/pipelines/stable_diffusion/adapter.mdx

Co-authored-by: Sayak Paul <[email protected]>

fix

remove from_adapters

license

paper link

docs

more url fixes

more docs

fix

fixes

fix

fix

* fix sample inplace add

* additional_kwargs -> additional_residuals

* move t2i adapter pipeline to own module

* preprocess -> _preprocess_adapter_image

* add TencentArc to license

* fix example code links

* add image converter and fix example doc string

* fix links

* clearer additional residual application

---------

Co-authored-by: HimariO <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants