This commit is contained in:
lllyasviel
2024-01-27 23:47:17 -08:00
parent e25faa902d
commit d58016c39a
2 changed files with 6 additions and 2 deletions

View File

@@ -88,7 +88,8 @@ class ControlNetExampleForge(scripts.Script):
unet = apply_controlnet_advanced(unet=unet, controlnet=self.model, image_bhwc=control_image,
strength=0.6, start_percent=0.0, end_percent=0.8,
positive_advanced_weighting=None, negative_advanced_weighting=None)
positive_advanced_weighting=None, negative_advanced_weighting=None,
only_apply_to_one_frame_in_a_batch=None)
p.sd_model.forge_objects.unet = unet

View File

@@ -6,11 +6,14 @@ def apply_controlnet_advanced(
start_percent,
end_percent,
positive_advanced_weighting=None,
negative_advanced_weighting=None):
negative_advanced_weighting=None,
only_apply_to_one_frame_in_a_batch=None,
):
cnet = controlnet.copy().set_cond_hint(image_bhwc.movedim(-1, 1), strength, (start_percent, end_percent))
cnet.positive_advanced_weighting = positive_advanced_weighting
cnet.negative_advanced_weighting = negative_advanced_weighting
cnet.only_apply_to_one_frame_in_a_batch = only_apply_to_one_frame_in_a_batch
m = unet.clone()
m.add_patched_controlnet(cnet)