The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Fix res_multistep_ancestral sampler (#8030)
Pam1b3bf0a5dac8
diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.pyindex 77ef748e8..fbdf6f554 100644--- a/comfy/k_diffusion/sampling.py+++ b/comfy/k_diffusion/sampling.py@@ -1277,6 +1277,7 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=Nonephi1_fn = lambda t: torch.expm1(t) / tphi2_fn = lambda t: (phi1_fn(t) - 1.0) / t+ old_sigma_down = Noneold_denoised = Noneuncond_denoised = Nonedef post_cfg_function(args):@@ -1304,9 +1305,9 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=Nonex = x + d * dtelse:# Second order multistep method in https://arxiv.org/pdf/2308.02157- t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigma_down), t_fn(sigmas[i - 1])+ t, t_old, t_next, t_prev = t_fn(sigmas[i]), t_fn(old_sigma_down), t_fn(sigma_down), t_fn(sigmas[i - 1])h = t_next - t- c2 = (t_prev - t) / h+ c2 = (t_prev - t_old) / hphi1_val, phi2_val = phi1_fn(-h), phi2_fn(-h)b1 = torch.nan_to_num(phi1_val - phi2_val / c2, nan=0.0)@@ -1326,6 +1327,7 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=Noneold_denoised = uncond_denoisedelse:old_denoised = denoised+ old_sigma_down = sigma_downreturn x@torch.no_grad()