Skip to content

Commit f086cbe

Browse files
committed
controlnet union XL, make control_image immutible
when this argument is passed a list, __call__ modifies its content, since it is pass by reference the list passed by the caller gets its content modified unexpectedly make a copy at method intro so this does not happen
1 parent 4f3ec53 commit f086cbe

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_inpaint_sd_xl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,8 @@ def __call__(
13701370

13711371
if not isinstance(control_image, list):
13721372
control_image = [control_image]
1373+
else:
1374+
control_image = control_image.copy()
13731375

13741376
if not isinstance(control_mode, list):
13751377
control_mode = [control_mode]

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,8 @@ def __call__(
11601160

11611161
if not isinstance(control_image, list):
11621162
control_image = [control_image]
1163+
else:
1164+
control_image = control_image.copy()
11631165

11641166
if not isinstance(control_mode, list):
11651167
control_mode = [control_mode]

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl_img2img.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,8 @@ def __call__(
13061306

13071307
if not isinstance(control_image, list):
13081308
control_image = [control_image]
1309+
else:
1310+
control_image = control_image.copy()
13091311

13101312
if not isinstance(control_mode, list):
13111313
control_mode = [control_mode]

0 commit comments

Comments
 (0)