From e45f6f2fc46a3aa88188c02dad6965609e0e698a Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:41:33 +0200 Subject: [PATCH 1/3] Allow WanVideoScheduler -node to work with the looping samplers Was broken for Multitalk/WanAnimate/S2V --- nodes.py | 4 +++- nodes_sampler.py | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index 9eb1d64..2aa04a8 100644 --- a/nodes.py +++ b/nodes.py @@ -1860,7 +1860,9 @@ class WanVideoScheduler: #WIP if start_idx > 0 and 0 <= start_idx < len(sigmas_np): ax.axvline(start_idx, color='green', linestyle='--', linewidth=2, label='start_step split') if (end_idx != -1 and 0 <= end_idx < len(sigmas_np)) or (start_idx > 0 and 0 <= start_idx < len(sigmas_np)): - ax.legend() + handles, labels = ax.get_legend_handles_labels() + if handles: + ax.legend() if start_idx < end_idx and 0 <= start_idx < len(sigmas_np) and 0 < end_idx < len(sigmas_np): ax.axvspan(start_idx, end_idx, color='lightblue', alpha=0.1, label='Sampled Range') plt.tight_layout() diff --git a/nodes_sampler.py b/nodes_sampler.py index 9b542ad..6575c2b 100644 --- a/nodes_sampler.py +++ b/nodes_sampler.py @@ -2255,6 +2255,8 @@ class WanVideoSampler: timesteps.append(0.) timesteps = [torch.tensor([t], device=device) for t in timesteps] timesteps = [timestep_transform(t, shift=shift, num_timesteps=1000) for t in timesteps] + elif isinstance(scheduler, dict): + sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) else: sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) timesteps = [torch.tensor([float(t)], device=device) for t in timesteps] + [torch.tensor([0.], device=device)] @@ -2567,7 +2569,10 @@ class WanVideoSampler: if s2v_pose is not None: s2v_pose_slice = pose_cond_list[r].to(device) - sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) + if isinstance(scheduler, dict): + sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) + else: + sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) latent = noise.to(device) for i, t in enumerate(tqdm(timesteps, desc=f"Sampling audio indices {left_idx}-{right_idx}", position=0)): @@ -2784,7 +2789,10 @@ class WanVideoSampler: thresholds = thresholds.reshape(-1, 1, 1, 1, 1).to(device) masks = (1-noise_mask.repeat(len(timesteps), 1, 1, 1, 1).to(device)) > thresholds - sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) + if isinstance(scheduler, dict): + sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) + else: + sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) # sample videos latent = noise From a64f115d35a3ac017bbd27458ef8a9c44eb385cc Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:06:38 +0200 Subject: [PATCH 2/3] Fix to previous --- nodes_sampler.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nodes_sampler.py b/nodes_sampler.py index 6575c2b..6e14403 100644 --- a/nodes_sampler.py +++ b/nodes_sampler.py @@ -2255,10 +2255,12 @@ class WanVideoSampler: timesteps.append(0.) timesteps = [torch.tensor([t], device=device) for t in timesteps] timesteps = [timestep_transform(t, shift=shift, num_timesteps=1000) for t in timesteps] - elif isinstance(scheduler, dict): - sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) else: - sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) + if isinstance(scheduler, dict): + sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) + timesteps = scheduler["timesteps"] + else: + sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) timesteps = [torch.tensor([float(t)], device=device) for t in timesteps] + [torch.tensor([0.], device=device)] # sample videos @@ -2571,6 +2573,7 @@ class WanVideoSampler: if isinstance(scheduler, dict): sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) + timesteps = scheduler["timesteps"] else: sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) @@ -2791,6 +2794,7 @@ class WanVideoSampler: if isinstance(scheduler, dict): sample_scheduler = copy.deepcopy(scheduler["sample_scheduler"]) + timesteps = scheduler["timesteps"] else: sample_scheduler, timesteps,_,_ = get_scheduler(scheduler, total_steps, start_step, end_step, shift, device, transformer.dim, flowedit_args, denoise_strength, sigmas=sigmas) From 9e0b3afe4eef5188ac441e83e06edd7ed2b26150 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:53:29 +0200 Subject: [PATCH 3/3] version checkpoint --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dfc7051..507faf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI-WanVideoWrapper" description = "ComfyUI wrapper nodes for WanVideo" -version = "1.3.7" +version = "1.3.8" license = {file = "LICENSE"} dependencies = ["accelerate >= 1.2.1", "diffusers >= 0.33.0", "peft >= 0.17.0", "ftfy", "gguf >= 0.17.1", "pyloudnorm"]