Skip to content

Support IP Adapter weight loading in StableDiffusionXLControlNetInpaintPipeline - #7031

Merged
yiyixuxu merged 2 commits into
huggingface:mainfrom
nkaewam:sdxl-cn-ip-ip-adapter-weight-load
Feb 19, 2024
Merged

Support IP Adapter weight loading in StableDiffusionXLControlNetInpaintPipeline#7031
yiyixuxu merged 2 commits into
huggingface:mainfrom
nkaewam:sdxl-cn-ip-ip-adapter-weight-load

Conversation

@nkaewam

Copy link
Copy Markdown
Contributor

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.

@yiyixuxu

Copy link
Copy Markdown
Collaborator

oh thanks for the PR!

can you make sure the tests pass? run make style

@nkaewam

Copy link
Copy Markdown
ContributorAuthor

@yiyixuxu Woops sorry, fixed

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@yiyixuxu
yiyixuxu merged commit d8d208a into huggingface:mainFeb 19, 2024
@nkaewamnkaewam changed the title Supper IP Adapter weight loading in StableDiffusionXLControlNetInpaintPipelineSupport IP Adapter weight loading in StableDiffusionXLControlNetInpaintPipelineFeb 20, 2024
Sign up for freeto 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

3 participants

@nkaewam@yiyixuxu@HuggingFaceDocBuilderDev