Skip to content

Conversation

yiyixuxu
Copy link
Collaborator

fix #7466

this now run

from diffusers import StableDiffusionXLControlNetInpaintPipeline, ControlNetModel
import torch
from PIL import Image

controlnet_canny = ControlNetModel.from_pretrained(
"diffusers/controlnet-canny-sdxl-1.0", torch_dtype=torch.float16
).to("cuda")

# inpaint
sdxl = StableDiffusionXLControlNetInpaintPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
use_safetensors=True,
controlnet=[controlnet_canny,controlnet_canny],
vae=vae,
add_watermarker=False
).to('cuda')

torch._dynamo.config.verbose = True
sdxl.controlnet.to(memory_format=torch.channels_last)
sdxl.controlnet = torch.compile(sdxl.controlnet, mode="reduce-overhead", fullgraph=True)

out = sdxl(
    prompt="dog",
    negative_prompt="dog",
    num_inference_steps=10,
    guidance_scale=4,
    strength=1.0,
    image=Image.new(mode="RGB", size=(200, 200)),
    mask_image=Image.new(mode="RGB", size=(200, 200)),
    control_image=[Image.new(mode="RGB", size=(200, 200)), Image.new(mode="RGB", size=(200, 200))],
    controlnet_conditioning_scale= [1.0, 0.3],
    )

@HuggingFaceDocBuilderDev

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 requested a review from sayakpaul March 26, 2024 16:30
if isinstance(self.controlnet, MultiControlNetModel):
controlnet_keep.append(keeps)
else:
controlnet_keep.append(keeps[0])
controlnet_keep.append(keeps if isinstance(controlnet, MultiControlNetModel) else keeps[0])
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the logical difference between these two though 🥲

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.

Thanks!

@sayakpaul sayakpaul merged commit ead82fe into main Mar 27, 2024
AbhinavGopal pushed a commit to AbhinavGopal/diffusers that referenced this pull request Mar 27, 2024
)

fix

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
noskill pushed a commit to noskill/diffusers that referenced this pull request Apr 5, 2024
)

fix

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
sayakpaul added a commit that referenced this pull request Dec 23, 2024
fix

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
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.

torch.compile failed for multi-controlnet of sdxl inpaint
3 participants