Handle case where start_step is greater than last_step

This commit is contained in:
David Lee 2026-05-04 15:26:21 -04:00 committed by GitHub
parent b715186140
commit 8dd41ef82e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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")