Skip to content

Commit b58bc77

Browse files
authored
fix: correct sampling when gamma is 0 (#3093)
1 parent 2d55a5f commit b58bc77

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ldm_patched/k_diffusion/sampling.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,5 +832,7 @@ def sample_tcd(model, x, sigmas, extra_args=None, callback=None, disable=None, n
832832
if eta > 0 and sigmas[i + 1] > 0:
833833
noise = noise_sampler(sigmas[i], sigmas[i + 1])
834834
x = x / alpha_prod_s[i+1].sqrt() + noise * (sigmas[i+1]**2 + 1 - 1/alpha_prod_s[i+1]).sqrt()
835+
else:
836+
x *= torch.sqrt(1.0 + sigmas[i + 1] ** 2)
835837

836838
return x

0 commit comments

Comments
 (0)