Skip to content

Commit

Permalink
Fix SamplerEulerCFGpp node.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 2, 2024
1 parent 2f03201 commit 01991f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions comfy_extras/nodes_advanced_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_sampler(self, scale_ratio, scale_steps, upscale_method):
import comfy.model_patcher

@torch.no_grad()
def sample_euler_cfgpp(model, x, sigmas, extra_args=None, callback=None, disable=None):
def sample_euler_pp(model, x, sigmas, extra_args=None, callback=None, disable=None):
extra_args = {} if extra_args is None else extra_args

temp = [0]
Expand All @@ -75,11 +75,11 @@ def post_cfg_function(args):
for i in trange(len(sigmas) - 1, disable=disable):
sigma_hat = sigmas[i]
denoised = model(x, sigma_hat * s_in, **extra_args)
d = to_d(x, sigma_hat, temp[0])
d = to_d(x - denoised + temp[0], sigmas[i], denoised)
if callback is not None:
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigma_hat, 'denoised': denoised})
dt = sigmas[i + 1] - sigma_hat
x = denoised + sigmas[i + 1] * d
x = x + d * dt
return x


Expand All @@ -96,10 +96,10 @@ def INPUT_TYPES(s):
FUNCTION = "get_sampler"

def get_sampler(self, version):
if version == "regular":
sampler = comfy.samplers.KSAMPLER(sample_euler_cfgpp)
if version == "alternative":
sampler = comfy.samplers.KSAMPLER(sample_euler_pp)
else:
sampler = comfy.samplers.ksampler("euler_pp")
sampler = comfy.samplers.ksampler("euler_cfg_pp")
return (sampler, )

NODE_CLASS_MAPPINGS = {
Expand Down

0 comments on commit 01991f7

Please sign in to comment.