mirror of
https://github.com/wassname/denoising-diffusion-pytorch.git
synced 2026-09-09 11:21:11 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bbb6ebf16 |
@@ -127,18 +127,12 @@ class ContinuousTimeGaussianDiffusion(nn.Module):
|
||||
# sampling related functions
|
||||
|
||||
@torch.no_grad()
|
||||
def p_sample(self, x, time, time_next, eps = 2e-4):
|
||||
def p_sample(self, x, time, time_next):
|
||||
batch, *_, device = *x.shape, x.device
|
||||
|
||||
model_mean, model_variance = self.p_mean_variance(x = x, time = time, time_next = time_next)
|
||||
noise = torch.randn_like(x)
|
||||
|
||||
# no noise when time is below some epsilon
|
||||
# not sure how important this is
|
||||
|
||||
time = repeat(time, ' -> b', b = batch)
|
||||
nonzero_mask = (1 - (time < eps).float()).reshape(batch, *((1,) * (len(x.shape) - 1)))
|
||||
return model_mean + nonzero_mask * sqrt(model_variance) * noise
|
||||
return model_mean + sqrt(model_variance) * noise
|
||||
|
||||
@torch.no_grad()
|
||||
def p_sample_loop(self, shape):
|
||||
|
||||
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
||||
setup(
|
||||
name = 'denoising-diffusion-pytorch',
|
||||
packages = find_packages(),
|
||||
version = '0.16.2',
|
||||
version = '0.16.3',
|
||||
license='MIT',
|
||||
description = 'Denoising Diffusion Probabilistic Models - Pytorch',
|
||||
author = 'Phil Wang',
|
||||
|
||||
Reference in New Issue
Block a user