Fixed injected frames with control video with mask

This commit is contained in:
deepbeepmeep 2025-06-27 08:28:28 +02:00 committed by GitHub
parent 10db954aaa
commit 81021e7a6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -253,7 +253,7 @@ class WanT2V:
if src_video_shape[1] != total_frames: if src_video_shape[1] != total_frames:
src_video[i] = torch.cat( [src_video[i], src_video[i].new_zeros(src_video_shape[0], total_frames -src_video_shape[1], *src_video_shape[-2:])], dim=1) src_video[i] = torch.cat( [src_video[i], src_video[i].new_zeros(src_video_shape[0], total_frames -src_video_shape[1], *src_video_shape[-2:])], dim=1)
src_mask[i] = torch.cat( [src_mask[i], src_mask[i].new_ones(src_video_shape[0], total_frames -src_video_shape[1], *src_video_shape[-2:])], dim=1) src_mask[i] = torch.cat( [src_mask[i], src_mask[i].new_ones(src_video_shape[0], total_frames -src_video_shape[1], *src_video_shape[-2:])], dim=1)
src_mask[i] = torch.clamp((src_mask[i][:1, :, :, :] + 1) / 2, min=0, max=1) src_mask[i] = torch.clamp((src_mask[i][:, :, :, :] + 1) / 2, min=0, max=1)
image_sizes.append(src_video[i].shape[2:]) image_sizes.append(src_video[i].shape[2:])
elif sub_src_video is None: elif sub_src_video is None:
if prepend_count > 0: if prepend_count > 0:
@ -654,4 +654,4 @@ class WanT2V:
module = modules_dict[f"vace_blocks.{vace_layer}"] module = modules_dict[f"vace_blocks.{vace_layer}"]
target = modules_dict[f"blocks.{model_layer}"] target = modules_dict[f"blocks.{model_layer}"]
setattr(target, "vace", module ) setattr(target, "vace", module )
delattr(model, "vace_blocks") delattr(model, "vace_blocks")