Skip to content

Commit

Permalink
release elucidating diffusion
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jun 29, 2022
1 parent c535d31 commit 86fcb67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions denoising_diffusion_pytorch/elucidated_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,18 @@ def preconditioned_network_forward(self, noised_images, sigma):
# sampling

@torch.no_grad()
def sample(self, batch_size = 16):
def sample(self, batch_size = 16, num_sample_steps = None):
num_sample_steps = default(num_sample_steps, self.num_sample_steps)

shape = (batch_size, self.channels, self.image_size, self.image_size)

# get the schedule, which is returned as (sigma, gamma) tuple, and pair up with the next sigma and gamma

sigmas = self.sample_schedule()
sigmas = self.sample_schedule(num_sample_steps)

gammas = torch.where(
(sigmas >= self.S_tmin) & (sigmas <= self.S_tmax),
min(self.S_churn / self.num_sample_steps, sqrt(2) - 1),
min(self.S_churn / num_sample_steps, sqrt(2) - 1),
0.
)

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.22.0',
version = '0.23.0',
license='MIT',
description = 'Denoising Diffusion Probabilistic Models - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 86fcb67

Please sign in to comment.