Skip to content

Commit 844e557

Browse files
committed
fix a missing residual needed at the top most resolution in the unet
1 parent 8b30be8 commit 844e557

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

denoising_diffusion_pytorch/denoising_diffusion_pytorch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def __init__(
243243

244244
self.channels = channels
245245

246-
init_dim = default(init_dim, dim // 3 * 2)
246+
init_dim = default(init_dim, dim)
247247
self.init_conv = nn.Conv2d(channels, init_dim, 7, padding = 3)
248248

249249
dims = [init_dim, *map(lambda m: dim * m, dim_mults)]
@@ -288,8 +288,8 @@ def __init__(
288288
self.mid_attn = Residual(PreNorm(mid_dim, Attention(mid_dim)))
289289
self.mid_block2 = block_klass(mid_dim, mid_dim, time_emb_dim = time_dim)
290290

291-
for ind, (dim_in, dim_out) in enumerate(reversed(in_out[1:])):
292-
is_last = ind >= (num_resolutions - 1)
291+
for ind, (dim_in, dim_out) in enumerate(reversed(in_out)):
292+
is_last = ind == (len(in_out) - 1)
293293

294294
self.ups.append(nn.ModuleList([
295295
block_klass(dim_out * 2, dim_in, time_emb_dim = time_dim),
@@ -324,7 +324,7 @@ def forward(self, x, time):
324324
x = self.mid_block2(x, t)
325325

326326
for block1, block2, attn, upsample in self.ups:
327-
x = torch.cat((x, h.pop()), dim=1)
327+
x = torch.cat((x, h.pop()), dim = 1)
328328
x = block1(x, t)
329329
x = block2(x, t)
330330
x = attn(x)

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.18.4',
6+
version = '0.19.1',
77
license='MIT',
88
description = 'Denoising Diffusion Probabilistic Models - Pytorch',
99
author = 'Phil Wang',

0 commit comments

Comments
 (0)