video mask: fixes for replacer extension (#509)

pull/515/head
Andray 2024-04-20 07:53:53 +04:00 committed by GitHub
parent 85a854b438
commit ecc6cf7953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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]]

View File

@ -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