@@ -537,15 +537,27 @@ def check_inputs(
537
537
f" { negative_prompt_embeds .shape } ."
538
538
)
539
539
540
- # Check `image`
540
+ # `prompt` needs more sophisticated handling when there are multiple
541
+ # conditionings.
542
+ if isinstance (self .controlnet , MultiControlNetModel ):
543
+ if isinstance (prompt , list ):
544
+ logger .warning (
545
+ f"You have { len (self .controlnet .nets )} ControlNets and you have passed { len (prompt )} "
546
+ " prompts. The conditionings will be fixed across the prompts."
547
+ )
541
548
549
+ # Check `image`
542
550
if isinstance (self .controlnet , ControlNetModel ):
543
551
self .check_image (image , prompt , prompt_embeds )
544
552
elif isinstance (self .controlnet , MultiControlNetModel ):
545
553
if not isinstance (image , list ):
546
554
raise TypeError ("For multiple controlnets: `image` must be type `list`" )
547
555
548
- if len (image ) != len (self .controlnet .nets ):
556
+ # When `image` is a nested list:
557
+ # (e.g. [[canny_image_1, pose_image_1], [canny_image_2, pose_image_2]])
558
+ elif any (isinstance (i , list ) for i in image ):
559
+ raise ValueError ("A single batch of multiple conditionings are supported at the moment." )
560
+ elif len (image ) != len (self .controlnet .nets ):
549
561
raise ValueError (
550
562
"For multiple controlnets: `image` must have the same length as the number of controlnets."
551
563
)
@@ -556,12 +568,14 @@ def check_inputs(
556
568
assert False
557
569
558
570
# Check `controlnet_conditioning_scale`
559
-
560
571
if isinstance (self .controlnet , ControlNetModel ):
561
572
if not isinstance (controlnet_conditioning_scale , float ):
562
573
raise TypeError ("For single controlnet: `controlnet_conditioning_scale` must be type `float`." )
563
574
elif isinstance (self .controlnet , MultiControlNetModel ):
564
- if isinstance (controlnet_conditioning_scale , list ) and len (controlnet_conditioning_scale ) != len (
575
+ if isinstance (controlnet_conditioning_scale , list ):
576
+ if any (isinstance (i , list ) for i in controlnet_conditioning_scale ):
577
+ raise ValueError ("A single batch of multiple conditionings are supported at the moment." )
578
+ elif isinstance (controlnet_conditioning_scale , list ) and len (controlnet_conditioning_scale ) != len (
565
579
self .controlnet .nets
566
580
):
567
581
raise ValueError (
0 commit comments