From b30f4584b7599ae86867e2752718762b03941b56 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 2 Mar 2025 02:22:49 +0200 Subject: [PATCH] fix previous fix --- enhance_a_video/globals.py | 1 + nodes.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/enhance_a_video/globals.py b/enhance_a_video/globals.py index d2bcddd..7413540 100644 --- a/enhance_a_video/globals.py +++ b/enhance_a_video/globals.py @@ -8,6 +8,7 @@ ENABLE_FETA= False def set_num_frames(num_frames: int): global NUM_FRAMES NUM_FRAMES = num_frames + print(f"NUM_FRAMES: {NUM_FRAMES}") @torch.compiler.disable() def get_num_frames() -> int: diff --git a/nodes.py b/nodes.py index b1a2981..c1c8c5e 100644 --- a/nodes.py +++ b/nodes.py @@ -863,9 +863,9 @@ class WanVideoContextOptions: def INPUT_TYPES(s): return {"required": { "context_schedule": (["uniform_standard", "uniform_looped", "static_standard"],), - "context_frames": ("INT", {"default": 65, "min": 2, "max": 1000, "step": 1, "tooltip": "Number of pixel frames in the context, NOTE: the latent space has 4 frames in 1"} ), + "context_frames": ("INT", {"default": 81, "min": 2, "max": 1000, "step": 1, "tooltip": "Number of pixel frames in the context, NOTE: the latent space has 4 frames in 1"} ), "context_stride": ("INT", {"default": 4, "min": 4, "max": 100, "step": 1, "tooltip": "Context stride as pixel frames, NOTE: the latent space has 4 frames in 1"} ), - "context_overlap": ("INT", {"default": 4, "min": 4, "max": 100, "step": 1, "tooltip": "Context overlap as pixel frames, NOTE: the latent space has 4 frames in 1"} ), + "context_overlap": ("INT", {"default": 16, "min": 4, "max": 100, "step": 1, "tooltip": "Context overlap as pixel frames, NOTE: the latent space has 4 frames in 1"} ), "freenoise": ("BOOLEAN", {"default": True, "tooltip": "Shuffle the noise"}), } } @@ -1017,9 +1017,6 @@ class WanVideoSampler: seq_len = math.ceil((noise.shape[2] * noise.shape[3]) / 4 * context_frames) - if feta_args is not None: - set_num_frames(context_frames) - if context_options["freenoise"]: log.info("Applying FreeNoise") # code and comments from AnimateDiff-Evolved by Kosinkadink (https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved) @@ -1104,7 +1101,10 @@ class WanVideoSampler: set_enhance_weight(feta_args["weight"]) feta_start_percent = feta_args["start_percent"] feta_end_percent = feta_args["end_percent"] - set_num_frames(latent_video_length) + if context_options is not None: + set_num_frames(context_frames) + else: + set_num_frames(latent_video_length) enable_enhance() else: disable_enhance()