Skip to content

Commit

Permalink
clipping for continuous time diffusion not working
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jun 8, 2022
1 parent d4ffa3f commit 4284c88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions denoising_diffusion_pytorch/continuous_time_gaussian_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(
loss_type = 'l1',
noise_schedule = 'linear',
num_sample_steps = 500,
clip_after_noising_during_sampling = False,
learned_schedule_net_hidden_dim = 1024,
learned_noise_schedule_frac_gradient = 1. # between 0 and 1, determines what percentage of gradients go back, so one can update the learned noise schedule more slowly
):
Expand Down Expand Up @@ -151,10 +150,6 @@ def __init__(

self.num_sample_steps = num_sample_steps

# clipping related hyperparameters

self.clip_after_noising_during_sampling = clip_after_noising_during_sampling

@property
def device(self):
return next(self.denoise_fn.parameters()).device
Expand Down Expand Up @@ -216,12 +211,9 @@ def p_sample_loop(self, shape):
times_next = steps[i + 1]
img = self.p_sample(img, times, times_next)

if self.clip_after_noising_during_sampling:
# clip after noise is added. perhaps this is sufficient for Imagen dynamic thresholding?
img.clamp_(-1., 1.)

img.clamp_(-1., 1.)
img = unnormalize_to_zero_to_one(img)
return img.clamp(0., 1.)
return img

@torch.no_grad()
def sample(self, batch_size = 16):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'denoising-diffusion-pytorch',
packages = find_packages(),
version = '0.17.3',
version = '0.17.4',
license='MIT',
description = 'Denoising Diffusion Probabilistic Models - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 4284c88

Please sign in to comment.