multi controlnet-union

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-02-13 07:54:47 -05:00
parent 5dacd918af
commit 9ce34b4c8c
4 changed files with 14 additions and 11 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
# Change Log for SD.Next
## Update for 2025-02-12
## Update for 2025-02-13
- **User Interface**
- **Hints**
@@ -74,6 +74,7 @@
- validate output before hires/refine
- scheduler fix sigma index out of bounds
- force pydantic version reinstall/reload
- multi-unit when using controlnet-union
## Update for 2025-02-05
+7 -2
View File
@@ -611,6 +611,8 @@ def control_run(state: str = '',
elif input_type == 1: # Init image same as control
if 'control_image' in possible:
p.task_args['control_image'] = p.init_images # switch image and control_image
if 'control_mode' in possible:
p.task_args['control_mode'] = getattr(p, 'control_mode', None)
if 'strength' in possible:
p.task_args['strength'] = p.denoising_strength
p.init_images = [p.override or input_image] * len(active_model)
@@ -620,9 +622,14 @@ def control_run(state: str = '',
init_image = input_image
if 'control_image' in possible:
p.task_args['control_image'] = p.init_images # switch image and control_image
if 'control_mode' in possible:
p.task_args['control_mode'] = getattr(p, 'control_mode', None)
if 'strength' in possible:
p.task_args['strength'] = p.denoising_strength
p.init_images = [init_image] * len(active_model)
if hasattr(shared.sd_model, 'controlnet') and len(p.task_args['control_image']) > 1 and (shared.sd_model.__class__.__name__ == 'StableDiffusionXLControlNetUnionPipeline'): # special case for controlnet-union
p.task_args['control_image'] = [[x] for x in p.task_args['control_image']]
p.task_args['control_mode'] = [[x] for x in p.task_args['control_mode']]
if is_generator:
image_txt = f'{blended_image.width}x{blended_image.height}' if blended_image is not None else 'None'
@@ -664,8 +671,6 @@ def control_run(state: str = '',
if unit_type == 'lite':
p.init_image = [input_image]
instance.apply(selected_models, processed_image, control_conditioning)
if getattr(p, 'control_mode', None) is not None:
p.task_args['control_mode'] = getattr(p, 'control_mode', None)
if hasattr(p, 'init_images') and p.init_images is None: # delete empty
del p.init_images
+4 -7
View File
@@ -338,14 +338,11 @@ class ControlNetPipeline():
classes = [c.__class__.__name__ for c in controlnets]
if any(c == 'ControlNetUnionModel' for c in classes):
if not all(c == 'ControlNetUnionModel' for c in classes):
log.warning(f'Control {what}: units={classes} mixed type')
log.warning(f'Control {what}: units={classes} mixed type is not supported')
return
if isinstance(controlnets, list) and len(controlnets) == 1:
controlnets = controlnets[0]
cls = StableDiffusionXLControlNetUnionPipeline
if len(controlnets) > 1:
# TODO controlnet-union multi-unit
controlnets = controlnets[0]
log.warning(f'Control {what}: units={classes} supports single unit only')
else:
controlnets = controlnets[0]
else:
cls = StableDiffusionXLControlNetPipeline
self.pipeline = cls(
+1 -1
Submodule wiki updated: 7a7687a989...cc0dc891de