Uh oh!
There was an error while loading. Please reload this page.
[feat] IP Adapters (author @okotaku ) - #5713
Conversation
yiyixuxu
commented
Nov 20, 2023
@marianbastiUNRN I think it is fine for now let me know if you're interested in working on this |
patrickvonplaten
left a comment
There was a problem hiding this comment.
Great job! Let's merge 🚀
* add ip-adapter --------- Co-authored-by: okotaku <to78314910@gmail.com> Co-authored-by: sayakpaul <spsayakpaul@gmail.com> Co-authored-by: yiyixuxu <yixu310@gmail,com> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
alexblattner
commented
Nov 27, 2023
I've been working on this for 2 weeks and now it's built in.... Thanks haha |
sayakpaul
commented
Nov 29, 2023
Open a new issue for this. It's ideal for users to comment on PRs after they have been merged. |
TonyLianLong
commented
Nov 30, 2023
This PR seems to break the positional arguments for We might want to clarify this in the release note for the next release. |
yiyixuxu
commented
Nov 30, 2023
hi @TonyLianLong |
MackorLab
commented
Dec 4, 2023
Hello, I’m just starting to program in Python and I still don’t understand exactly how to do it correctly |
okaris
commented
Dec 7, 2023
@yiyixuxu I'm interested in implementing this, can you guide me to the steps necessary please? |
* add ip-adapter --------- Co-authored-by: okotaku <to78314910@gmail.com> Co-authored-by: sayakpaul <spsayakpaul@gmail.com> Co-authored-by: yiyixuxu <yixu310@gmail,com> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
xhinker
commented
Dec 28, 2023
Hi, @yiyixuxu Could you also provide an img2img IPAdaptor sample for SDXL? I always got below error when using SDXL. Thanks! |
xhinker
commented
Dec 28, 2023
Never mind, I figured it out, I need to use the sd_models' image encode explicitly. like this: image_encoder=CLIPVisionModelWithProjection.from_pretrained(
<IP-AdapterModelPath>subfolder="models/image_encoder",
torch_dtype=torch.float16,
).to("cuda")
pipeline=StableDiffusionXLImg2ImgPipeline.from_pretrained(
<pretrainmodelpath>
, torch_dtype=torch.float16
, image_encoder=image_encoder
)
pipeline.to("cuda") |
thibaudart
commented
Jan 10, 2024
is it possible to load multiple image as reference for IP adapter? |
patrickvonplaten
commented
Jan 11, 2024
Hey @thibaudart, Hope you're doing well - we've just recently opened the Discussion tab on the Diffusers' repo: https://github.com/huggingface/diffusers/discussions |
thibaudart
commented
Jan 12, 2024
of course |
* add ip-adapter --------- Co-authored-by: okotaku <to78314910@gmail.com> Co-authored-by: sayakpaul <spsayakpaul@gmail.com> Co-authored-by: yiyixuxu <yixu310@gmail,com> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
xingyouxin
commented
May 13, 2024
For controlnet and ip-Adapter, I have a question about the multi-computation by using a batch size, e.g., batch_size = 4. I try to put image, prompt, and generator lists, etc. into the pipeline. But the result failed with an error: ValueError: Thus, maybe the multi-computation by using a batch size is not added in this project. I am not sure. Could anyone help me? Thanks. |
asomoza
commented
May 13, 2024
it would be better if you open a new issue with this, also you will need to provide us with a minimal reproducible code. Without it, I can say that the error message says it all, you are passing 4 images to the ip adapters but you're only loading one ip adapter. Probably the error lies in how are you passing the images for the batch. |
xingyouxin
commented
May 13, 2024
Hello, Mr. asomoza. Thanks for your reply. With your help, I have taken some tests but still failed. So I open an issue about the details. |
Dear asomoza, it seems that I have figured out my problem. Finally, I find that the ip-Adapter embedding is not supported to work with a batch of images separately. It deals with all the images in one batch uniformly. Thus, the better way is to embed the adapter images one by one and then cat (torch.cat) them up. Then we pass the catted embeddings into our pipeline to generate images in one batch separately. The details can be seen in this issue #7933. Thank you very much. |



the author of this PR is @okotaku
and the original PR: #4944
this is a demo of alternative design (alterative to #4944) that add the image_projection layer to Unet
works with SD, SDXL
it works with text-to-image, image-to-image, inpaint, see text-to-image example below, and you can find examples for img2img here and inpaint here
It works with LCM-Lora out of box
work with controlnet
work with animate diff