From c150a6bafeb21824f30b813ae1212321a5d131fd Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Tue, 6 Oct 2026 06:55:00 -0300 Subject: [PATCH] fix: correct step count adjustment for custom sigmas list (#2084) --- src/pipeline/request.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pipeline/request.cpp b/src/pipeline/request.cpp index 075ae67f..69ebe0b3 100644 --- a/src/pipeline/request.cpp +++ b/src/pipeline/request.cpp @@ -375,17 +375,19 @@ namespace sd::pipeline { total_steps = sample_steps + std::max(0, high_noise_sample_steps); if (sample_params->custom_sigmas_count > 0) { - sigmas = std::vector(sample_params->custom_sigmas, + sigmas = std::vector(sample_params->custom_sigmas, sample_params->custom_sigmas + sample_params->custom_sigmas_count); - total_steps = static_cast(sigmas.size()) - 1; - LOG_WARN("total_steps != custom_sigmas_count - 1, set total_steps to %d", total_steps); - if (sample_steps >= total_steps) { - sample_steps = total_steps; - LOG_WARN("total_steps != custom_sigmas_count - 1, set sample_steps to %d", sample_steps); - } - if (high_noise_sample_steps > 0) { - high_noise_sample_steps = total_steps - sample_steps; - LOG_WARN("total_steps != custom_sigmas_count - 1, set high_noise_sample_steps to %d", high_noise_sample_steps); + if (total_steps != sample_params->custom_sigmas_count - 1) { + total_steps = sample_params->custom_sigmas_count - 1; + LOG_WARN("total_steps != custom_sigmas_count - 1, set total_steps to %d", total_steps); + if ((sample_steps > total_steps) || (high_noise_sample_steps <= 0 && sample_steps != total_steps)) { + sample_steps = total_steps; + LOG_WARN("total_steps != custom_sigmas_count - 1, set sample_steps to %d", sample_steps); + } + if (high_noise_sample_steps > 0) { + high_noise_sample_steps = total_steps - sample_steps; + LOG_WARN("total_steps != custom_sigmas_count - 1, set high_noise_sample_steps to %d", high_noise_sample_steps); + } } } else { scheduler_t scheduler = resolve_scheduler(sd,