How do you apply Starting Control Step and Ending Control step in Python?

#18
by runshouse - opened

I'd like to replicate what Automatic1111 webui does using diffusers

@runshouse did u find a solution?

Hi, this is an example of how to use it with canny edge controlnet:

controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained("Lykon/DreamShaper", controlnet=controlnet, torch_dtype=torch.float16)

out_image = pipe("dragon", generator=generator, image=in_image, control_image=canny_image, strength=9, control_guidance_start=0, control_guidance_end=0.6).images[0]

More examples here:
https://github.com/huggingface/diffusers/blob/78922ed7c7e66c20aa95159c7b7a6057ba7d590d/tests/pipelines/controlnet/test_controlnet_img2img.py#L316

Thank you so much @lkkgkkkk !

Sign up or log in to comment