-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental per control type scale for ControlNet Union #10723
Conversation
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. |
Is this one possible to use pro-max version as well? Thanks |
@john09282922 Yes. |
import torch
from diffusers import StableDiffusionXLControlNetUnionPipeline
from diffusers.models import ControlNetUnionModel, AutoencoderKL
from diffusers.utils import load_image
room_seg_img = load_image(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/room_seg.png"
)
pose_img = load_image(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/pose.png"
)
controlnet = ControlNetUnionModel.from_pretrained(
"brad-twinkl/controlnet-union-sdxl-1.0-promax", torch_dtype=torch.float16
)
vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16
)
pipe = StableDiffusionXLControlNetUnionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
controlnet=controlnet,
vae=vae,
torch_dtype=torch.float16,
variant="fp16",
)
pipe.enable_model_cpu_offload()
image = pipe(
prompt="an astronaut in space",
width=1024,
height=1024,
negative_prompt="lowres, low quality, worst quality",
control_image=[pose_img, room_seg_img],
control_mode=[0, 5],
#controlnet_conditioning_scale=[0.0, 1.0],
num_inference_steps=50,
generator=torch.Generator().manual_seed(42),
).images[0]
image.save("result.jpg") Also unifies the interface for MultiControlNet cc @vladmandic simply splits to list of list internally cc @guiyrt
Uses standard scaling with |
What does this PR do?
This adds experimental support for per control type scale to ControlNet Union.
Code
Control images
Canny
:control_image=[canny]
Canny Seg
:control_image=[seg, canny]
Canny No Seg
:control_image=[seg, canny]
withcontrolnet_conditioning_scale=[0.0, 1.0]
Fixes #10656
Note: we will also add
MultiControlNet
support for ControlNet Union in another PR.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 @asomoza @vladmandic