From 8dd41ef82e9cf254a43a5afd1fba84901f774f76 Mon Sep 17 00:00:00 2001 From: David Lee <47388918+Pizzawookiee@users.noreply.github.com> Date: Mon, 4 May 2026 15:26:21 -0400 Subject: [PATCH] Handle case where start_step is greater than last_step --- comfy_extras/nodes_custom_sampler.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.py index f90545b9a..d73ceffbf 100644 --- a/comfy_extras/nodes_custom_sampler.py +++ b/comfy_extras/nodes_custom_sampler.py @@ -83,7 +83,14 @@ def time_to_move_sample(model, noise, steps, cfg, sampler_name, scheduler, posit if start_step == None: start_step = 0 - for i in range (min(last_step, steps) - start_step): + total_iterations = min(last_step, steps) - start_step + if total_iterations <= 0: + return latent_image.to( + device=comfy.model_management.intermediate_device(), + dtype=comfy.model_management.intermediate_dtype(), + ) + + for i in range(total_iterations): if i > 0: #don't add new noise to samples after first step taken noise = torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")