Fix dpmpp_2s_ancestral_cfg_pp: save temp[0] before second model call

temp[0] (uncond_denoised) was getting overwritten by the second model call before being used in the final x calculation.
This commit is contained in:
amatiramisu 2026-01-16 14:52:18 +01:00 committed by GitHub
parent 9125613b53
commit 76909f1dfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1322,9 +1322,10 @@ def sample_dpmpp_2s_ancestral_cfg_pp(model, x, sigmas, extra_args=None, callback
r = 1 / 2 r = 1 / 2
h = t_next - t h = t_next - t
s = t + r * h s = t + r * h
x_2 = (sigma_fn(s) / sigma_fn(t)) * (x + (denoised - temp[0])) - (-h * r).expm1() * denoised uncond_denoised = temp[0]
x_2 = (sigma_fn(s) / sigma_fn(t)) * (x + (denoised - uncond_denoised)) - (-h * r).expm1() * denoised
denoised_2 = model(x_2, sigma_fn(s) * s_in, **extra_args) denoised_2 = model(x_2, sigma_fn(s) * s_in, **extra_args)
x = (sigma_fn(t_next) / sigma_fn(t)) * (x + (denoised - temp[0])) - (-h).expm1() * denoised_2 x = (sigma_fn(t_next) / sigma_fn(t)) * (x + (denoised - uncond_denoised)) - (-h).expm1() * denoised_2
# Noise addition # Noise addition
if sigmas[i + 1] > 0: if sigmas[i + 1] > 0:
x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * sigma_up x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * sigma_up