Skip to content

Commit 0dabf47

Browse files
committed
Revert "enforce zero terminal snr for cosine schedule"
This reverts commit 6d15667.
1 parent 77e8405 commit 0dabf47

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,3 @@ You could consider adding a suitable metric to the training loop yourself after
311311
year = {2023}
312312
}
313313
```
314-
315-
```bibtex
316-
@inproceedings{Lin2023CommonDN,
317-
title = {Common Diffusion Noise Schedules and Sample Steps are Flawed},
318-
author = {Shanchuan Lin and Bingchen Liu and Jiashi Li and Xiao Yang},
319-
year = {2023}
320-
}
321-
```

denoising_diffusion_pytorch/denoising_diffusion_pytorch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def cosine_beta_schedule(timesteps, s = 0.008):
424424
alphas_cumprod = torch.cos((t + s) / (1 + s) * math.pi * 0.5) ** 2
425425
alphas_cumprod = alphas_cumprod / alphas_cumprod[0]
426426
betas = 1 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
427-
return torch.clip(betas, 0, 1.)
427+
return torch.clip(betas, 0, 0.999)
428428

429429
def sigmoid_beta_schedule(timesteps, start = -3, end = 3, tau = 1, clamp_min = 1e-5):
430430
"""
@@ -439,7 +439,7 @@ def sigmoid_beta_schedule(timesteps, start = -3, end = 3, tau = 1, clamp_min = 1
439439
alphas_cumprod = (-((t * (end - start) + start) / tau).sigmoid() + v_end) / (v_end - v_start)
440440
alphas_cumprod = alphas_cumprod / alphas_cumprod[0]
441441
betas = 1 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
442-
return torch.clip(betas, 0, 1.)
442+
return torch.clip(betas, 0, 0.999)
443443

444444
class GaussianDiffusion(nn.Module):
445445
def __init__(

denoising_diffusion_pytorch/denoising_diffusion_pytorch_1d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def cosine_beta_schedule(timesteps, s = 0.008):
407407
alphas_cumprod = torch.cos(((x / timesteps) + s) / (1 + s) * math.pi * 0.5) ** 2
408408
alphas_cumprod = alphas_cumprod / alphas_cumprod[0]
409409
betas = 1 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
410-
return torch.clip(betas, 0, 1.)
410+
return torch.clip(betas, 0, 0.999)
411411

412412
class GaussianDiffusion1D(nn.Module):
413413
def __init__(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.6.0'
1+
__version__ = '1.5.8'

0 commit comments

Comments
 (0)