stable-diffusion.cpp icon indicating copy to clipboard operation
stable-diffusion.cpp copied to clipboard

denoiser.hpp: simplify DPM++ (2S) Ancestral

Open vmobilis opened this issue 10 months ago • 0 comments

DPMPP2S_A: https://github.com/leejet/stable-diffusion.cpp/blob/10c6501bd05a697e014f1bee3a84e5664290c489/denoiser.hpp#L686 Current formula:

if (sigma_down == 0) {
    d = (x - denoised) / sigmas[i];
    dt = sigma_down - sigmas[i];
    x += d * dt;
}

Since sigma_down == 0 => dt == -sigmas[i] => d * dt == (x - denoised) / sigmas[i] * (-sigmas[i]) == denoised - x => x = x + denoised - x => x = denoised


Proof:
BeforeAfter

Images are almost same. And thank you for the program.

vmobilis avatar Apr 30 '25 19:04 vmobilis