diff --git a/README.md b/README.md index 2afb472e..caa61e60 100644 --- a/README.md +++ b/README.md @@ -455,9 +455,9 @@ class ControlNetExampleForge(scripts.Script): 'output': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2] } negative_advanced_weighting = { - 'input': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2], - 'middle': [1.0], - 'output': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2] + 'input': [0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25], + 'middle': [1.05], + 'output': [0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25] } # The advanced_frame_weighting is a weight applied to each image in a batch. @@ -480,7 +480,7 @@ class ControlNetExampleForge(scripts.Script): advanced_frame_weighting = None advanced_sigma_weighting = None - unet = apply_controlnet_advanced(unet=unet, controlnet=self.model, image_bhwc=control_image, + unet = apply_controlnet_advanced(unet=unet, controlnet=self.model, image_bchw=control_image.movedim(-1, 1), strength=0.6, start_percent=0.0, end_percent=0.8, positive_advanced_weighting=positive_advanced_weighting, negative_advanced_weighting=negative_advanced_weighting, diff --git a/extensions-builtin/sd_forge_controlnet_example/scripts/sd_forge_controlnet_example.py b/extensions-builtin/sd_forge_controlnet_example/scripts/sd_forge_controlnet_example.py index 9a41ddb5..da8a28f2 100644 --- a/extensions-builtin/sd_forge_controlnet_example/scripts/sd_forge_controlnet_example.py +++ b/extensions-builtin/sd_forge_controlnet_example/scripts/sd_forge_controlnet_example.py @@ -130,7 +130,7 @@ class ControlNetExampleForge(scripts.Script): advanced_frame_weighting = None advanced_sigma_weighting = None - unet = apply_controlnet_advanced(unet=unet, controlnet=self.model, image_bhwc=control_image, + unet = apply_controlnet_advanced(unet=unet, controlnet=self.model, image_bchw=control_image.movedim(-1, 1), strength=0.6, start_percent=0.0, end_percent=0.8, positive_advanced_weighting=positive_advanced_weighting, negative_advanced_weighting=negative_advanced_weighting, diff --git a/modules_forge/controlnet.py b/modules_forge/controlnet.py index 3d4959b6..24371de9 100644 --- a/modules_forge/controlnet.py +++ b/modules_forge/controlnet.py @@ -8,7 +8,7 @@ def get_at(array, index, default=None): def apply_controlnet_advanced( unet, controlnet, - image_bhwc, + image_bchw, strength, start_percent, end_percent, @@ -55,7 +55,7 @@ def apply_controlnet_advanced( """ - cnet = controlnet.copy().set_cond_hint(image_bhwc.movedim(-1, 1), strength, (start_percent, end_percent)) + cnet = controlnet.copy().set_cond_hint(image_bchw, strength, (start_percent, end_percent)) cnet.positive_advanced_weighting = positive_advanced_weighting cnet.negative_advanced_weighting = negative_advanced_weighting cnet.advanced_frame_weighting = advanced_frame_weighting