minor sampling improvements

mainly using a dynamic rho value (hey this sounds a lot like smea!!!)
This commit is contained in:
yoinked 2024-08-29 17:45:17 -07:00 committed by GitHub
parent 194a410783
commit 161d678f17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1103,6 +1103,9 @@ def sample_euler_ancestral_cfg_pp(model, x, sigmas, extra_args=None, callback=No
return x
@torch.no_grad()
def sample_dpmpp_2s_ancestral_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None):
if isinstance(model.inner_model.inner_model.model_sampling, comfy.model_sampling.CONST):
return sample_dpmpp_2s_ancestral_RF(model, x, sigmas, extra_args, callback, disable, eta, s_noise, noise_sampler)
"""Ancestral sampling with DPM-Solver++(2S) second-order steps."""
extra_args = {} if extra_args is None else extra_args
noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler
@ -1132,7 +1135,7 @@ def sample_dpmpp_2s_ancestral_cfg_pp(model, x, sigmas, extra_args=None, callback
else:
# DPM-Solver++(2S)
t, t_next = t_fn(sigmas[i]), t_fn(sigma_down)
r = 1 / 2
r = torch.sinh(1 + (2 - eta) * (t_next - t) / (t - t_fn(sigma_up)))
h = t_next - t
s = t + r * h
x_2 = (sigma_fn(s) / sigma_fn(t)) * (x + (denoised - temp[0])) - (-h * r).expm1() * denoised