Skip to content
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

IP-Adapter support? #46

Open
jadechip opened this issue Jun 3, 2024 · 2 comments
Open

IP-Adapter support? #46

jadechip opened this issue Jun 3, 2024 · 2 comments

Comments

@jadechip
Copy link

jadechip commented Jun 3, 2024

Would be cool to have support for IP-Adapter added. As the pipeline inherits from StableDiffusionXLImg2ImgPipeline which supports ip-adapter, I assume it should be quite simple to add support for ip-adapter? ...but give the custom implementation of the sampling process, I am not so sure, perhaps something like this?

if ip_adapter_image is not None or ip_adapter_image_embeds is not None:
    image_embeds = self.prepare_ip_adapter_image_embeds(
        ip_adapter_image,
        ip_adapter_image_embeds,
        device,
        batch_size * num_images_per_prompt,
        self.do_classifier_free_guidance,
    )

if ip_adapter_image is not None or ip_adapter_image_embeds is not None:
    added_cond_kwargs["image_embeds"] = image_embeds
@jadechip
Copy link
Author

jadechip commented Jun 3, 2024

I took a quick stab at it, but I am not sure if this is right? #56
Need to run some tests...

@jadechip
Copy link
Author

jadechip commented Jun 4, 2024

Currently unable to load the ip-adapter image, seems like the weights of the clip encoder isn't loaded on the gpu?

 File "/home/user/.pyenv/versions/3.10.14/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py", line 774, in encode_image
    image_embeds = self.image_encoder(image).image_embeds

`RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same`

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

No branches or pull requests

1 participant