mirror of
https://github.com/lucidrains/DALLE2-pytorch.git
synced 2025-12-19 17:54:20 +01:00
upgrade to best downsample
This commit is contained in:
10
README.md
10
README.md
@@ -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>
|
||||||
|
|||||||
@@ -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):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = '1.9.0'
|
__version__ = '1.10.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user