From f61aae615833177df906e8140eb151a3720aa1d4 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 27 Jul 2025 17:10:41 +0300 Subject: [PATCH] minimax + context windows --- nodes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index b2b44b3..ff61234 100644 --- a/nodes.py +++ b/nodes.py @@ -1632,7 +1632,7 @@ class WanVideoSampler: num_prompts = len(text_embeds["prompt_embeds"]) log.info(f"Number of prompts: {num_prompts}") # Calculate which section this context window belongs to - section_size = latent_video_length / num_prompts + section_size = (latent_video_length / num_prompts) if num_prompts != 0 else 1 log.info(f"Section size: {section_size}") is_looped = context_schedule == "uniform_looped" @@ -1980,7 +1980,10 @@ class WanVideoSampler: add_cond_input = add_cond if minimax_latents is not None: - z_pos = z_neg = torch.cat([z, minimax_latents, minimax_mask_latents], dim=0) + if context_window is not None: + z_pos = z_neg = torch.cat([z, minimax_latents[:, context_window], minimax_mask_latents[:, context_window]], dim=0) + else: + z_pos = z_neg = torch.cat([z, minimax_latents, minimax_mask_latents], dim=0) if not multitalk_sampling and multitalk_audio_embedding is not None: audio_embedding = multitalk_audio_embedding