Compare commits

...

3 Commits

Author SHA1 Message Date
Sergii Dymchenko
a2fc55e467
Merge 76b7c71b6e into ff838657fa 2025-01-09 20:13:10 +08:00
Sergii Dymchenko
76b7c71b6e
Use non-alias 2025-01-07 15:51:19 -08:00
Sergii Dymchenko
e4e2d82b0f
Use torch.special.expm1
This function provides greater precision than `exp(x) - 1` for small values of `x`.

Found with TorchFix https://github.com/pytorch-labs/torchfix/
2025-01-07 15:39:37 -08:00

View File

@ -40,7 +40,7 @@ def get_sigmas_polyexponential(n, sigma_min, sigma_max, rho=1., device='cpu'):
def get_sigmas_vp(n, beta_d=19.9, beta_min=0.1, eps_s=1e-3, device='cpu'):
"""Constructs a continuous VP noise schedule."""
t = torch.linspace(1, eps_s, n, device=device)
sigmas = torch.sqrt(torch.exp(beta_d * t ** 2 / 2 + beta_min * t) - 1)
sigmas = torch.sqrt(torch.special.expm1(beta_d * t ** 2 / 2 + beta_min * t))
return append_zero(sigmas)