Closed AboMad closed 4 years ago
It is very possible that Pytorch 1.4 is dealing with the code differently.
When we wrote the book, Pytorch 1.2 was the latest version and the program tested and worked properly.
You might want to consider setting up a virtual environment using pytorch 1.2 or 1.3 and re-running the program. However, remember that having different versions of various dependent libraries can cause some results to be different from those presented in the book.
I have to say that I like your changes. Good job!
I am a newbie in PyTorch, I have tried to reproduce your code of chapter 4 (DCGAN on MNIST), but the model diverged after 25 epochs, it produced very blurry and unrecognized images. But, after changing the initialization function to:
def weights_init(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.normal_(m.weight.data, 0.0, 0.02) elif classname.find('BatchNorm') != -1: nn.init.normal_(m.weight.data, 1.0, 0.02) nn.init.constant_(m.bias.data, 0)
it works properly! I am using Pytorch 1.4, with Cuda 10.1 Does the difference in the Pytorch version cause this issue? I mean is it advisable to degrade to Pytorch 1.3 or I can reproduce the codes in this book in my current one.