Skip to content

Commit

Permalink
SDXL ControlNet Union pipelines, make control_image argument immutible (
Browse files Browse the repository at this point in the history
#10663)

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

Co-authored-by: Teriks <[email protected]>
  • Loading branch information
Teriks and Teriks authored Jan 27, 2025
1 parent 8ceec90 commit e89ab5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,8 @@ def __call__(

if not isinstance(control_image, list):
control_image = [control_image]
else:
control_image = control_image.copy()

if not isinstance(control_mode, list):
control_mode = [control_mode]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,8 @@ def __call__(

if not isinstance(control_image, list):
control_image = [control_image]
else:
control_image = control_image.copy()

if not isinstance(control_mode, list):
control_mode = [control_mode]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,8 @@ def __call__(

if not isinstance(control_image, list):
control_image = [control_image]
else:
control_image = control_image.copy()

if not isinstance(control_mode, list):
control_mode = [control_mode]
Expand Down

0 comments on commit e89ab5b

Please sign in to comment.