Skip to content
Python

added test for long control video and steady dancer

DeepBeepMeep66477ab087f7
diff --git a/models/wan/wan_handler.py b/models/wan/wan_handler.py
index 21b371b..7ba1001 100644
--- a/models/wan/wan_handler.py
+++ b/models/wan/wan_handler.py
@@ -318,6 +318,7 @@ class family_handler():
extra_model_def["alt_guidance"] = "Condition Guidance"
extra_model_def["no_guide2_refresh"] = True
extra_model_def["no_mask_refresh"] = True
+ extra_model_def["control_video_trim"] = True
if base_model_type in ["infinitetalk"]:
diff --git a/wgp.py b/wgp.py
index fd76bff..468d5a0 100644
--- a/wgp.py
+++ b/wgp.py
@@ -5357,6 +5357,7 @@ def generate_video(
context_scale = None
window_no = 0
extra_windows = 0
+ abort_scheduled = False
guide_start_frame = 0 # pos of of first control video frame of current window (reuse_frames later than the first processed frame)
keep_frames_parsed = [] # aligned to the first control frame of current window (therefore ignore previous reuse_frames)
pre_video_guide = None # reuse_frames of previous window
@@ -5601,6 +5602,10 @@ def generate_video(
if src_video is None or window_no >1 and src_video.shape[1] <= sliding_window_overlap and not dont_cat_preguide:
abort = True
break
+ if model_def.get("control_video_trim", False) and src_video is not None:
+ if src_video.shape[1] < current_video_length:
+ current_video_length = src_video.shape[1]
+ abort_scheduled = True
if src_faces is not None:
if src_faces.shape[1] < src_video.shape[1]:
src_faces = torch.concat( [src_faces, src_faces[:, -1:].repeat(1, src_video.shape[1] - src_faces.shape[1], 1,1)], dim =1)
@@ -5823,7 +5828,7 @@ def generate_video(
send_cmd("output")
else:
sample = samples.cpu()
- abort = not (is_image or audio_only) and sample.shape[1] < current_video_length
+ abort = abort_scheduled or not (is_image or audio_only) and sample.shape[1] < current_video_length
# if True: # for testing
# torch.save(sample, "output.pt")
# else: