@@ -240,8 +247,8 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
...
@@ -240,8 +247,8 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
):
):
super().__init__()
super().__init__()
ifnotisinstance(controlnet,ControlNetUnionModel):
ifisinstance(controlnet,(list,tuple)):
raiseValueError("Expected `controlnet` to be of type `ControlNetUnionModel`.")
controlnet=MultiControlNetUnionModel(controlnet)
self.register_modules(
self.register_modules(
vae=vae,
vae=vae,
...
@@ -660,6 +667,7 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
...
@@ -660,6 +667,7 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
controlnet_conditioning_scale=1.0,
controlnet_conditioning_scale=1.0,
control_guidance_start=0.0,
control_guidance_start=0.0,
control_guidance_end=1.0,
control_guidance_end=1.0,
control_mode=None,
callback_on_step_end_tensor_inputs=None,
callback_on_step_end_tensor_inputs=None,
padding_mask_crop=None,
padding_mask_crop=None,
):
):
...
@@ -747,25 +755,34 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
...
@@ -747,25 +755,34 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
"If `negative_prompt_embeds` are provided, `negative_pooled_prompt_embeds` also have to be passed. Make sure to generate `negative_pooled_prompt_embeds` from the same text encoder that was used to generate `negative_prompt_embeds`."
"If `negative_prompt_embeds` are provided, `negative_pooled_prompt_embeds` also have to be passed. Make sure to generate `negative_pooled_prompt_embeds` from the same text encoder that was used to generate `negative_prompt_embeds`."
)
)
# `prompt` needs more sophisticated handling when there are multiple
raiseTypeError("For multiple controlnets: `image` must be type `list`")
elifnotall(isinstance(i,list)foriinimage):
raiseValueError("For multiple controlnets: elements of `image` must be list of conditionings.")
eliflen(image)!=len(self.controlnet.nets):
raiseValueError(
f"For multiple controlnets: `image` must have the same length as the number of controlnets, but got {len(image)} images and {len(self.controlnet.nets)} ControlNets."
@@ -778,6 +795,12 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
...
@@ -778,6 +795,12 @@ class StableDiffusionXLControlNetUnionInpaintPipeline(
f"`control_guidance_start` has {len(control_guidance_start)} elements, but `control_guidance_end` has {len(control_guidance_end)} elements. Make sure to provide the same number of elements to each list."
f"`control_guidance_start` has {len(control_guidance_start)} elements, but `control_guidance_end` has {len(control_guidance_end)} elements. Make sure to provide the same number of elements to each list."
f"`control_guidance_start`: {control_guidance_start} has {len(control_guidance_start)} elements but there are {len(self.controlnet.nets)} controlnets available. Make sure to provide {len(self.controlnet.nets)}."