Skip to content

Conversation

nkaewam
Copy link
Contributor

@nkaewam nkaewam commented Feb 19, 2024

What does this PR do?

Fixes #6866 and also an extension of PR: #6941

Added IPAdapterMixin loader to StableDiffusionXLControlNetInpaintPipeline to allow for .load_ip_adapter in pipeline.

Example snippet code:

image_encoder = CLIPVisionModelWithProjection.from_pretrained(
            "h94/IP-Adapter",
            subfolder="models/image_encoder",
            torch_dtype=torch.float16,
            cache_dir=CACHE_DIR
).to(device)


pipe = StableDiffusionXLControlNetInpaintPipeline.from_pretrained(
            weight_path,
            cache_dir=CACHE_DIR,
            vae=sd_vae,
            controlnet=controlnet, 
            image_encoder=image_encoder,
            torch_dtype=torch.float16
).to(device)
 
# this PR allows this to be possible      
pipe.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter-plus_sdxl_vit-h.safetensors", cache_dir=CACHE_DIR)

images = pipe(
            image=room_image,
            ip_adapter_image=style_image, 
            control_image=control_image, 
            mask_image=mask_image,
            ...other-params
).images

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@nkaewam nkaewam closed this Feb 19, 2024
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.

IP-Adapter support for StableDiffusionXLControlNetInpaintPipeline
1 participant