From 6fd91a8f006636bf0a2ddf306a280b6ca0591af7 Mon Sep 17 00:00:00 2001 From: JettHu Date: Mon, 3 Jun 2024 19:36:15 +0800 Subject: [PATCH] fix: correct sampling when gamma is 0 --- comfy/k_diffusion/sampling.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index d9032feb5..829fa383e 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -841,5 +841,7 @@ def sample_tcd( if eta > 0 and sigmas[i + 1] > 0: noise = noise_sampler(sigmas[i], sigmas[i + 1]) x = x / alpha_prod_s[i+1].sqrt() + noise * (sigmas[i+1]**2 + 1 - 1/alpha_prod_s[i+1]).sqrt() + else: + x *= torch.sqrt(1.0 + sigmas[i + 1] ** 2) return x