Skip to content

Conversation

@kadirnar
Copy link
Contributor

#3612 (comment)
I fixed the error but check it out. Because I don't know this pipeline algorithm.

import cv2
import torch
import numpy as np
from PIL import Image
from diffusers import UniPCMultistepScheduler
from diffusers.utils import load_image

input_image = load_image("https://hf.co/datasets/huggingface/documentation-images/resolve/main/diffusers/input_image_vermeer.png")

# get canny image
image = cv2.Canny(np.array(input_image), 100, 200)
image = image[:, :, None]
image = np.concatenate([image, image, image], axis=2)
canny_image = Image.fromarray(image)

controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetReferencePipeline.from_pretrained(
       "runwayml/stable-diffusion-v1-5",
       controlnet=controlnet,
       safety_checker=None,
       torch_dtype=torch.float16
       ).to('cuda:0')

pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)

result_img = pipe(ref_image=input_image,
      prompt="1girl",
      image=canny_image,
      num_inference_steps=20,
      reference_attn=True,
      reference_adain=True).images[0]

Input_Image

@kadirnar
Copy link
Contributor Author

Can you check? @okotaku

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 12, 2023

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor

Looks good to me

@okotaku
Copy link
Contributor

okotaku commented Jun 13, 2023

@kadirnar Thank you for your contribution, but I fixed it in this PR.
#3723

@kadirnar
Copy link
Contributor Author

Looks good to me

Should I close this pull request?

@okotaku
Copy link
Contributor

okotaku commented Jun 16, 2023

Yes. My PR was merged.

@kadirnar kadirnar closed this Jun 16, 2023
@kadirnar kadirnar deleted the fix_default_height_width_func branch June 16, 2023 13:00
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.

4 participants