InfiniteTalk: Add option to save results during the process, make it clearer no latents are returned

This commit is contained in:
kijai
2025-09-08 18:50:53 +03:00
parent e5955d8395
commit fe379fa77f
4 changed files with 496 additions and 479 deletions
+15 -6
View File
@@ -6,6 +6,7 @@ import torch
from ..utils import log, set_module_tensor_to_device
import os
import json
import datetime
script_directory = os.path.dirname(os.path.abspath(__file__))
folder_paths.add_model_folder_path("wav2vec2", os.path.join(folder_paths.models_dir, "wav2vec2"))
@@ -389,17 +390,19 @@ class WanVideoImageToVideoMultiTalk:
"auto",
"multitalk",
"infinitetalk"
], {"default": "auto", "tooltip": "The sampling strategy to use in the long video generation loop, should match the model used"})
], {"default": "auto", "tooltip": "The sampling strategy to use in the long video generation loop, should match the model used"}),
"output_path": ("STRING", {"default": "", "tooltip": "If set, will save each window's resulting frames to this folder"}),
}
}
RETURN_TYPES = ("WANVIDIMAGE_EMBEDS",)
RETURN_NAMES = ("image_embeds",)
RETURN_TYPES = ("WANVIDIMAGE_EMBEDS", "STRING",)
RETURN_NAMES = ("image_embeds", "output_path")
FUNCTION = "process"
CATEGORY = "WanVideoWrapper"
DESCRIPTION = "Enables Multi/InfiniteTalk long video generation sampling method, the video is created in windows with overlapping frames. Not compatible or necessary to be used with context windows and many other features besides Multi/InfiniteTalk."
def process(self, vae, width, height, frame_window_size, motion_frame, force_offload, colormatch, start_image=None, tiled_vae=False, clip_embeds=None, mode="multitalk"):
def process(self, vae, width, height, frame_window_size, motion_frame, force_offload, colormatch, start_image=None, tiled_vae=False, clip_embeds=None, mode="multitalk", output_path=""):
H = height
W = width
@@ -416,6 +419,11 @@ class WanVideoImageToVideoMultiTalk:
target_shape = (16, (num_frames - 1) // VAE_STRIDE[0] + 1,
height // VAE_STRIDE[1],
width // VAE_STRIDE[2])
if output_path:
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
output_path = os.path.join(output_path, f"{timestamp}_{mode}_output")
os.makedirs(output_path, exist_ok=True)
image_embeds = {
"multitalk_sampling": True,
@@ -430,10 +438,11 @@ class WanVideoImageToVideoMultiTalk:
"target_shape": target_shape,
"clip_context": clip_embeds.get("clip_embeds", None) if clip_embeds is not None else None,
"colormatch": colormatch,
"multitalk_mode": mode
"multitalk_mode": mode,
"output_path": output_path
}
return (image_embeds,)
return (image_embeds, output_path)
NODE_CLASS_MAPPINGS = {
"MultiTalkModelLoader": MultiTalkModelLoader,