Argument parsing and model training

Now, the only thing left for us to do is to create and define the main entry for the project. In this file, we will need to define the arguments we previously have assumed to be known. These hyper-parameters are essential when we create any network, and we will elegantly parse these values. Let's create a new file called main.py and import the necessary modules:

import argparseimport osimport sysimport numpy as npimport torchimport torch.backends.cudnn as cudnnimport torch.utils.dataimport torchvision.datasets as dsetimport torchvision.transforms as transformsimport utilsfrom build_gan import Model

Have you noticed that the only Python module that's related to our model is build_gan.Model? We can easily ...

Get Hands-On Generative Adversarial Networks with PyTorch 1.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.