Skip to content

Commit 4284c88

Browse files
committed
clipping for continuous time diffusion not working
1 parent d4ffa3f commit 4284c88

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

denoising_diffusion_pytorch/continuous_time_gaussian_diffusion.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def __init__(
115115
loss_type = 'l1',
116116
noise_schedule = 'linear',
117117
num_sample_steps = 500,
118-
clip_after_noising_during_sampling = False,
119118
learned_schedule_net_hidden_dim = 1024,
120119
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
121120
):
@@ -151,10 +150,6 @@ def __init__(
151150

152151
self.num_sample_steps = num_sample_steps
153152

154-
# clipping related hyperparameters
155-
156-
self.clip_after_noising_during_sampling = clip_after_noising_during_sampling
157-
158153
@property
159154
def device(self):
160155
return next(self.denoise_fn.parameters()).device
@@ -216,12 +211,9 @@ def p_sample_loop(self, shape):
216211
times_next = steps[i + 1]
217212
img = self.p_sample(img, times, times_next)
218213

219-
if self.clip_after_noising_during_sampling:
220-
# clip after noise is added. perhaps this is sufficient for Imagen dynamic thresholding?
221-
img.clamp_(-1., 1.)
222-
214+
img.clamp_(-1., 1.)
223215
img = unnormalize_to_zero_to_one(img)
224-
return img.clamp(0., 1.)
216+
return img
225217

226218
@torch.no_grad()
227219
def sample(self, batch_size = 16):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'denoising-diffusion-pytorch',
55
packages = find_packages(),
6-
version = '0.17.3',
6+
version = '0.17.4',
77
license='MIT',
88
description = 'Denoising Diffusion Probabilistic Models - Pytorch',
99
author = 'Phil Wang',

0 commit comments

Comments
 (0)