Commit c150a6b for stable-diffusion.cpp
commit c150a6bafeb21824f30b813ae1212321a5d131fd
Author: Wagner Bruna <wbruna@users.noreply.github.com>
Date: Tue Oct 6 06:55:00 2026 -0300
fix: correct step count adjustment for custom sigmas list (#2084)
diff --git a/src/pipeline/request.cpp b/src/pipeline/request.cpp
index 075ae67..69ebe0b 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<float>(sample_params->custom_sigmas,
+ sigmas = std::vector<float>(sample_params->custom_sigmas,
sample_params->custom_sigmas + sample_params->custom_sigmas_count);
- total_steps = static_cast<int>(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,