diff --git a/motion_module.py b/motion_module.py index 4fffd52..f17ff69 100644 --- a/motion_module.py +++ b/motion_module.py @@ -330,8 +330,8 @@ class VersatileAttention(CrossAttention): def forward(self, x: torch.Tensor): - from scripts.animatediff_mm import mm_animatediff - video_length = mm_animatediff.ad_params.batch_size + from scripts import animatediff_mm + video_length = animatediff_mm.mm_animatediff.ad_params.batch_size d = x.shape[1] x = rearrange(x, "(b f) d c -> (b d) f c", f=video_length) diff --git a/scripts/animatediff_output.py b/scripts/animatediff_output.py index bee23e7..9bbe943 100644 --- a/scripts/animatediff_output.py +++ b/scripts/animatediff_output.py @@ -27,6 +27,7 @@ class AnimateDiffOutput: output_dir.mkdir(parents=True, exist_ok=True) step = params.video_length if params.video_length > params.batch_size else params.batch_size for i in range(res.index_of_first_image, len(res.images), step): + if i-res.index_of_first_image >= len(res.all_seeds): break # frame interpolation replaces video_list with interpolated frames # so make a copy instead of a slice (reference), to avoid modifying res frame_list = [image.copy() for image in res.images[i : i + params.video_length]] diff --git a/scripts/animatediff_ui.py b/scripts/animatediff_ui.py index 6318fc8..2d51320 100644 --- a/scripts/animatediff_ui.py +++ b/scripts/animatediff_ui.py @@ -182,7 +182,7 @@ class AnimateDiffProcess: cn_unit.batch_images = self.video_path # mask path broadcast - if cn_unit.input_mode.name == 'BATCH' and self.mask_path and not cn_unit.batch_mask_dir: + if cn_unit.input_mode.name == 'BATCH' and self.mask_path and not getattr(cn_unit, 'batch_mask_dir', False): cn_unit.batch_mask_dir = self.mask_path # find minimun control images in CN batch