upgrade to best downsample

This commit is contained in:
Phil Wang
2022-08-25 10:37:02 -07:00
parent 59fa101c4d
commit 1cc5d0afa7
4 changed files with 19 additions and 4 deletions

View File

@@ -1285,4 +1285,14 @@ For detailed information on training the diffusion prior, please refer to the [d
} }
``` ```
```bibtex
@article{Sunkara2022NoMS,
title = {No More Strided Convolutions or Pooling: A New CNN Building Block for Low-Resolution Images and Small Objects},
author = {Raja Sunkara and Tie Luo},
journal = {ArXiv},
year = {2022},
volume = {abs/2208.03641}
}
```
*Creating noise from data is easy; creating data from noise is generative modeling.* - <a href="https://arxiv.org/abs/2011.13456">Yang Song's paper</a> *Creating noise from data is easy; creating data from noise is generative modeling.* - <a href="https://arxiv.org/abs/2011.13456">Yang Song's paper</a>

View File

@@ -1479,9 +1479,14 @@ class PixelShuffleUpsample(nn.Module):
def forward(self, x): def forward(self, x):
return self.net(x) return self.net(x)
def Downsample(dim, *, dim_out = None): def Downsample(dim, dim_out = None):
# https://arxiv.org/abs/2208.03641 shows this is the most optimal way to downsample
# named SP-conv in the paper, but basically a pixel unshuffle
dim_out = default(dim_out, dim) dim_out = default(dim_out, dim)
return nn.Conv2d(dim, dim_out, 4, 2, 1) return nn.Sequential(
Rearrange('b c (h s1) (w s2) -> b (c s1 s2) h w', s1 = 2, s2 = 2),
nn.Conv2d(dim * 4, dim_out, 1)
)
class WeightStandardizedConv2d(nn.Conv2d): class WeightStandardizedConv2d(nn.Conv2d):
""" """

View File

@@ -519,7 +519,7 @@ class DecoderTrainer(nn.Module):
clip = decoder.clip clip = decoder.clip
clip.to(precision_type) clip.to(precision_type)
decoder, train_dataloader, *optimizers = list(self.accelerator.prepare(decoder, dataloaders['train'], *optimizers)) decoder, *optimizers = list(self.accelerator.prepare(decoder, *optimizers))
self.decoder = decoder self.decoder = decoder

View File

@@ -1 +1 @@
__version__ = '1.9.0' __version__ = '1.10.0'