Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks.

In [1]:
%load_ext watermark
%watermark -a 'Sebastian Raschka' -v -p torch
Sebastian Raschka 

CPython 3.7.3
IPython 7.9.0

torch 1.7.0
  • Runs on CPU or GPU (if available)

Model Zoo -- Wasserstein Generative Adversarial Networks (GAN)

Implementation of a very simple/rudimentary Wasserstein GAN using just fully connected layers.

The Wasserstein GAN is based on the paper

The main differences to a regular GAN are annotated in the code. In short, the main differences are

  1. Not using a sigmoid activation function and just using a linear output layer for the critic (i.e., discriminator).
  2. Using label -1 instead of 1 for the real images; using label 1 instead of 0 for fake images.
  3. Using Wasserstein distance (loss) for training both the critic and the generator.
  4. After each weight update, clip the weights to be in range [-0.1, 0.1].
  5. Train the critic 5 times for each generator training update.

Imports

In [2]:
import time
import numpy as np
import torch
import torch.nn.functional as F
from torchvision import datasets
from torchvision import transforms
import torch.nn as nn
from torch.utils.data import DataLoader


if torch.cuda.is_available():
    torch.backends.cudnn.deterministic = True

Settings and Dataset

In [3]:
##########################
### SETTINGS
##########################

# Device
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

# Hyperparameters
random_seed = 0
generator_learning_rate = 0.0005
discriminator_learning_rate = 0.0005
NUM_EPOCHS = 100
BATCH_SIZE = 128
LATENT_DIM = 50
IMG_SHAPE = (1, 28, 28)
IMG_SIZE = 1
for x in IMG_SHAPE:
    IMG_SIZE *= x

## WGAN-specific settings
num_iter_critic = 5
weight_clip_value = 0.01



##########################
### MNIST DATASET
##########################

# Note transforms.ToTensor() scales input images
# to 0-1 range
train_dataset = datasets.MNIST(root='data', 
                               train=True, 
                               transform=transforms.ToTensor(),
                               download=True)

test_dataset = datasets.MNIST(root='data', 
                              train=False, 
                              transform=transforms.ToTensor())


train_loader = DataLoader(dataset=train_dataset, 
                          batch_size=BATCH_SIZE, 
                          shuffle=True)

test_loader = DataLoader(dataset=test_dataset, 
                         batch_size=BATCH_SIZE, 
                         shuffle=False)

# Checking the dataset
for images, labels in train_loader:  
    print('Image batch dimensions:', images.shape)
    print('Image label dimensions:', labels.shape)
    break
Image batch dimensions: torch.Size([128, 1, 28, 28])
Image label dimensions: torch.Size([128])

Model

In [4]:
##########################
### MODEL
##########################


def wasserstein_loss(y_true, y_pred):
    return torch.mean(y_true * y_pred)


class GAN(torch.nn.Module):

    def __init__(self):
        super(GAN, self).__init__()
        
        
        self.generator = nn.Sequential(
            nn.Linear(LATENT_DIM, 128),
            nn.LeakyReLU(inplace=True),
            #nn.Dropout(p=0.5),
            nn.Linear(128, IMG_SIZE),
            nn.Tanh()
        )
        
        self.discriminator = nn.Sequential(
            nn.Linear(IMG_SIZE, 128),
            nn.LeakyReLU(inplace=True),
            #nn.Dropout(p=0.5),
            nn.Linear(128, 1),
            #nn.Sigmoid() # WGAN should have linear activation
        )

            
    def generator_forward(self, z):
        img = self.generator(z)
        return img
    
    def discriminator_forward(self, img):
        pred = model.discriminator(img)
        return pred.view(-1)
In [5]:
torch.manual_seed(random_seed)

model = GAN()
model = model.to(device)

optim_gener = torch.optim.Adam(model.generator.parameters(), lr=generator_learning_rate)
optim_discr = torch.optim.Adam(model.discriminator.parameters(), lr=discriminator_learning_rate)

Training

In [6]:
start_time = time.time()    

discr_costs = []
gener_costs = []
for epoch in range(NUM_EPOCHS):
    model = model.train()
    for batch_idx, (features, targets) in enumerate(train_loader):

        
        
        features = (features - 0.5)*2.
        features = features.view(-1, IMG_SIZE).to(device) 
        targets = targets.to(device)

        # Regular GAN:
        # valid = torch.ones(targets.size(0)).float().to(device)
        # fake = torch.zeros(targets.size(0)).float().to(device)
        
        # WGAN:
        valid = -(torch.ones(targets.size(0)).float()).to(device)
        fake = torch.ones(targets.size(0)).float().to(device)
        

        ### FORWARD AND BACK PROP
        
        
        # --------------------------
        # Train Generator
        # --------------------------
        
        # Make new images
        z = torch.zeros((targets.size(0), LATENT_DIM)).uniform_(-1.0, 1.0).to(device)
        generated_features = model.generator_forward(z)
        
        # Loss for fooling the discriminator
        discr_pred = model.discriminator_forward(generated_features)
        
        
        # Regular GAN:
        # gener_loss = F.binary_cross_entropy_with_logits(discr_pred, valid)
        
        # WGAN:
        gener_loss = wasserstein_loss(valid, discr_pred)
        
        optim_gener.zero_grad()
        gener_loss.backward()
        optim_gener.step()
        
        # --------------------------
        # Train Discriminator
        # --------------------------        

        
        # WGAN: 5 loops for discriminator
        for _ in range(num_iter_critic):
        
            discr_pred_real = model.discriminator_forward(features.view(-1, IMG_SIZE))
            # Regular GAN:
            # real_loss = F.binary_cross_entropy_with_logits(discr_pred_real, valid)
            # WGAN:
            real_loss = wasserstein_loss(valid, discr_pred_real)

            discr_pred_fake = model.discriminator_forward(generated_features.detach())

            # Regular GAN:
            # fake_loss = F.binary_cross_entropy_with_logits(discr_pred_fake, fake)
            # WGAN:
            fake_loss = wasserstein_loss(fake, discr_pred_fake)

            # Regular GAN:
            discr_loss = (real_loss + fake_loss)
            # WGAN:
            #discr_loss = -(real_loss - fake_loss)

            optim_discr.zero_grad()
            discr_loss.backward()
            optim_discr.step()        

            # WGAN:
            for p in model.discriminator.parameters():
                p.data.clamp_(-weight_clip_value, weight_clip_value)

        
        discr_costs.append(discr_loss.item())
        gener_costs.append(gener_loss.item())
        
        
        
        
        ### LOGGING
        if not batch_idx % 100:
            print ('Epoch: %03d/%03d | Batch %03d/%03d | Gen/Dis Loss: %.4f/%.4f' 
                   %(epoch+1, NUM_EPOCHS, batch_idx, 
                     len(train_loader), gener_loss, discr_loss))

    print('Time elapsed: %.2f min' % ((time.time() - start_time)/60))
    
print('Total Training Time: %.2f min' % ((time.time() - start_time)/60))
Epoch: 001/100 | Batch 000/469 | Gen/Dis Loss: -0.0519/-0.2590
Epoch: 001/100 | Batch 100/469 | Gen/Dis Loss: -2.3542/-0.7692
Epoch: 001/100 | Batch 200/469 | Gen/Dis Loss: -2.0051/-0.4396
Epoch: 001/100 | Batch 300/469 | Gen/Dis Loss: -2.0768/-0.3943
Epoch: 001/100 | Batch 400/469 | Gen/Dis Loss: -2.1300/-0.2482
Time elapsed: 0.23 min
Epoch: 002/100 | Batch 000/469 | Gen/Dis Loss: -1.9071/-0.3102
Epoch: 002/100 | Batch 100/469 | Gen/Dis Loss: -1.7146/-0.3059
Epoch: 002/100 | Batch 200/469 | Gen/Dis Loss: -1.1119/-0.2778
Epoch: 002/100 | Batch 300/469 | Gen/Dis Loss: -1.7026/-0.2407
Epoch: 002/100 | Batch 400/469 | Gen/Dis Loss: -2.5018/-0.3091
Time elapsed: 0.43 min
Epoch: 003/100 | Batch 000/469 | Gen/Dis Loss: -2.3521/-0.3923
Epoch: 003/100 | Batch 100/469 | Gen/Dis Loss: -2.4121/-0.0815
Epoch: 003/100 | Batch 200/469 | Gen/Dis Loss: 0.7962/-0.4601
Epoch: 003/100 | Batch 300/469 | Gen/Dis Loss: 0.4143/-0.2456
Epoch: 003/100 | Batch 400/469 | Gen/Dis Loss: 0.5025/-0.1760
Time elapsed: 0.63 min
Epoch: 004/100 | Batch 000/469 | Gen/Dis Loss: 0.2936/-0.2024
Epoch: 004/100 | Batch 100/469 | Gen/Dis Loss: 0.2512/-0.1884
Epoch: 004/100 | Batch 200/469 | Gen/Dis Loss: 0.2651/-0.1717
Epoch: 004/100 | Batch 300/469 | Gen/Dis Loss: 0.0757/-0.2229
Epoch: 004/100 | Batch 400/469 | Gen/Dis Loss: 0.0861/-0.2141
Time elapsed: 0.84 min
Epoch: 005/100 | Batch 000/469 | Gen/Dis Loss: 0.0504/-0.2027
Epoch: 005/100 | Batch 100/469 | Gen/Dis Loss: 0.1028/-0.1916
Epoch: 005/100 | Batch 200/469 | Gen/Dis Loss: 0.0453/-0.2073
Epoch: 005/100 | Batch 300/469 | Gen/Dis Loss: 0.1046/-0.2076
Epoch: 005/100 | Batch 400/469 | Gen/Dis Loss: 0.0345/-0.2062
Time elapsed: 1.05 min
Epoch: 006/100 | Batch 000/469 | Gen/Dis Loss: 0.1727/-0.1755
Epoch: 006/100 | Batch 100/469 | Gen/Dis Loss: 0.0390/-0.1798
Epoch: 006/100 | Batch 200/469 | Gen/Dis Loss: 0.0152/-0.1769
Epoch: 006/100 | Batch 300/469 | Gen/Dis Loss: 0.0941/-0.1842
Epoch: 006/100 | Batch 400/469 | Gen/Dis Loss: 0.0499/-0.1918
Time elapsed: 1.27 min
Epoch: 007/100 | Batch 000/469 | Gen/Dis Loss: 0.0534/-0.1916
Epoch: 007/100 | Batch 100/469 | Gen/Dis Loss: 0.0582/-0.1720
Epoch: 007/100 | Batch 200/469 | Gen/Dis Loss: 0.0579/-0.1695
Epoch: 007/100 | Batch 300/469 | Gen/Dis Loss: 0.0301/-0.1762
Epoch: 007/100 | Batch 400/469 | Gen/Dis Loss: 0.0527/-0.1875
Time elapsed: 1.49 min
Epoch: 008/100 | Batch 000/469 | Gen/Dis Loss: 0.0047/-0.1685
Epoch: 008/100 | Batch 100/469 | Gen/Dis Loss: 0.0790/-0.1731
Epoch: 008/100 | Batch 200/469 | Gen/Dis Loss: 0.0452/-0.1532
Epoch: 008/100 | Batch 300/469 | Gen/Dis Loss: 0.0667/-0.1664
Epoch: 008/100 | Batch 400/469 | Gen/Dis Loss: 0.0671/-0.1472
Time elapsed: 1.70 min
Epoch: 009/100 | Batch 000/469 | Gen/Dis Loss: -0.1168/-0.1543
Epoch: 009/100 | Batch 100/469 | Gen/Dis Loss: -0.0275/-0.1722
Epoch: 009/100 | Batch 200/469 | Gen/Dis Loss: -0.0670/-0.1380
Epoch: 009/100 | Batch 300/469 | Gen/Dis Loss: 0.0860/-0.1640
Epoch: 009/100 | Batch 400/469 | Gen/Dis Loss: -0.0830/-0.1598
Time elapsed: 1.92 min
Epoch: 010/100 | Batch 000/469 | Gen/Dis Loss: -0.0486/-0.1543
Epoch: 010/100 | Batch 100/469 | Gen/Dis Loss: -0.0919/-0.1593
Epoch: 010/100 | Batch 200/469 | Gen/Dis Loss: -0.1185/-0.1507
Epoch: 010/100 | Batch 300/469 | Gen/Dis Loss: 0.2264/-0.1845
Epoch: 010/100 | Batch 400/469 | Gen/Dis Loss: -0.0288/-0.1592
Time elapsed: 2.15 min
Epoch: 011/100 | Batch 000/469 | Gen/Dis Loss: 0.0199/-0.1172
Epoch: 011/100 | Batch 100/469 | Gen/Dis Loss: -0.0620/-0.1829
Epoch: 011/100 | Batch 200/469 | Gen/Dis Loss: -0.2088/-0.1470
Epoch: 011/100 | Batch 300/469 | Gen/Dis Loss: -0.2648/-0.1350
Epoch: 011/100 | Batch 400/469 | Gen/Dis Loss: -0.3467/-0.1724
Time elapsed: 2.37 min
Epoch: 012/100 | Batch 000/469 | Gen/Dis Loss: -0.4080/-0.1568
Epoch: 012/100 | Batch 100/469 | Gen/Dis Loss: -0.7657/-0.0293
Epoch: 012/100 | Batch 200/469 | Gen/Dis Loss: -0.5468/-0.2377
Epoch: 012/100 | Batch 300/469 | Gen/Dis Loss: -1.2844/-0.3580
Epoch: 012/100 | Batch 400/469 | Gen/Dis Loss: -2.7551/-0.2147
Time elapsed: 2.60 min
Epoch: 013/100 | Batch 000/469 | Gen/Dis Loss: -1.7467/-0.0907
Epoch: 013/100 | Batch 100/469 | Gen/Dis Loss: -2.7303/-0.0891
Epoch: 013/100 | Batch 200/469 | Gen/Dis Loss: -2.6419/0.0203
Epoch: 013/100 | Batch 300/469 | Gen/Dis Loss: -0.8218/-0.1482
Epoch: 013/100 | Batch 400/469 | Gen/Dis Loss: -0.5836/-0.0678
Time elapsed: 2.82 min
Epoch: 014/100 | Batch 000/469 | Gen/Dis Loss: -0.3991/-0.0687
Epoch: 014/100 | Batch 100/469 | Gen/Dis Loss: -0.5065/-0.0607
Epoch: 014/100 | Batch 200/469 | Gen/Dis Loss: -0.5567/-0.0668
Epoch: 014/100 | Batch 300/469 | Gen/Dis Loss: -0.6253/-0.0645
Epoch: 014/100 | Batch 400/469 | Gen/Dis Loss: -0.3879/-0.0675
Time elapsed: 3.04 min
Epoch: 015/100 | Batch 000/469 | Gen/Dis Loss: -0.4144/-0.0552
Epoch: 015/100 | Batch 100/469 | Gen/Dis Loss: -0.5014/-0.0597
Epoch: 015/100 | Batch 200/469 | Gen/Dis Loss: -0.3966/-0.0677
Epoch: 015/100 | Batch 300/469 | Gen/Dis Loss: -0.6472/-0.0579
Epoch: 015/100 | Batch 400/469 | Gen/Dis Loss: -0.4149/-0.0627
Time elapsed: 3.27 min
Epoch: 016/100 | Batch 000/469 | Gen/Dis Loss: -0.2195/-0.0803
Epoch: 016/100 | Batch 100/469 | Gen/Dis Loss: -0.3068/-0.0720
Epoch: 016/100 | Batch 200/469 | Gen/Dis Loss: -0.2980/-0.0629
Epoch: 016/100 | Batch 300/469 | Gen/Dis Loss: -0.3517/-0.0619
Epoch: 016/100 | Batch 400/469 | Gen/Dis Loss: -0.2649/-0.0652
Time elapsed: 3.49 min
Epoch: 017/100 | Batch 000/469 | Gen/Dis Loss: -0.2006/-0.0646
Epoch: 017/100 | Batch 100/469 | Gen/Dis Loss: -0.2398/-0.0810
Epoch: 017/100 | Batch 200/469 | Gen/Dis Loss: -0.3902/-0.0692
Epoch: 017/100 | Batch 300/469 | Gen/Dis Loss: -0.2892/-0.0965
Epoch: 017/100 | Batch 400/469 | Gen/Dis Loss: -0.1373/-0.0793
Time elapsed: 3.71 min
Epoch: 018/100 | Batch 000/469 | Gen/Dis Loss: -0.6073/-0.0757
Epoch: 018/100 | Batch 100/469 | Gen/Dis Loss: -1.0577/-0.1260
Epoch: 018/100 | Batch 200/469 | Gen/Dis Loss: -1.6690/-0.2670
Epoch: 018/100 | Batch 300/469 | Gen/Dis Loss: -0.1478/-0.3556
Epoch: 018/100 | Batch 400/469 | Gen/Dis Loss: -0.9182/-0.1792
Time elapsed: 3.94 min
Epoch: 019/100 | Batch 000/469 | Gen/Dis Loss: 0.1504/-0.0533
Epoch: 019/100 | Batch 100/469 | Gen/Dis Loss: -0.9131/-0.1791
Epoch: 019/100 | Batch 200/469 | Gen/Dis Loss: -1.7046/-0.0276
Epoch: 019/100 | Batch 300/469 | Gen/Dis Loss: -0.0904/-0.2029
Epoch: 019/100 | Batch 400/469 | Gen/Dis Loss: -0.9669/-0.1121
Time elapsed: 4.16 min
Epoch: 020/100 | Batch 000/469 | Gen/Dis Loss: -2.1731/-0.0876
Epoch: 020/100 | Batch 100/469 | Gen/Dis Loss: -0.1601/-0.0603
Epoch: 020/100 | Batch 200/469 | Gen/Dis Loss: -0.5421/-0.1073
Epoch: 020/100 | Batch 300/469 | Gen/Dis Loss: -0.2042/-0.0753
Epoch: 020/100 | Batch 400/469 | Gen/Dis Loss: -0.3516/-0.0610
Time elapsed: 4.38 min
Epoch: 021/100 | Batch 000/469 | Gen/Dis Loss: -0.3735/-0.0515
Epoch: 021/100 | Batch 100/469 | Gen/Dis Loss: -0.3435/-0.0578
Epoch: 021/100 | Batch 200/469 | Gen/Dis Loss: -0.3828/-0.0577
Epoch: 021/100 | Batch 300/469 | Gen/Dis Loss: -0.2621/-0.0567
Epoch: 021/100 | Batch 400/469 | Gen/Dis Loss: -0.2977/-0.0625
Time elapsed: 4.59 min
Epoch: 022/100 | Batch 000/469 | Gen/Dis Loss: -0.3331/-0.0763
Epoch: 022/100 | Batch 100/469 | Gen/Dis Loss: -0.1885/-0.0613
Epoch: 022/100 | Batch 200/469 | Gen/Dis Loss: -0.2759/-0.0524
Epoch: 022/100 | Batch 300/469 | Gen/Dis Loss: -0.5057/-0.0597
Epoch: 022/100 | Batch 400/469 | Gen/Dis Loss: -0.2072/-0.0557
Time elapsed: 4.82 min
Epoch: 023/100 | Batch 000/469 | Gen/Dis Loss: -0.1932/-0.0640
Epoch: 023/100 | Batch 100/469 | Gen/Dis Loss: -0.1665/-0.0632
Epoch: 023/100 | Batch 200/469 | Gen/Dis Loss: -0.2458/-0.0522
Epoch: 023/100 | Batch 300/469 | Gen/Dis Loss: -0.1301/-0.0617
Epoch: 023/100 | Batch 400/469 | Gen/Dis Loss: -0.1029/-0.0619
Time elapsed: 5.04 min
Epoch: 024/100 | Batch 000/469 | Gen/Dis Loss: -0.1794/-0.0556
Epoch: 024/100 | Batch 100/469 | Gen/Dis Loss: -0.1865/-0.0649
Epoch: 024/100 | Batch 200/469 | Gen/Dis Loss: 0.9111/-0.0913
Epoch: 024/100 | Batch 300/469 | Gen/Dis Loss: 0.7172/-0.1890
Epoch: 024/100 | Batch 400/469 | Gen/Dis Loss: -1.7994/-0.2592
Time elapsed: 5.26 min
Epoch: 025/100 | Batch 000/469 | Gen/Dis Loss: -1.0366/-0.2872
Epoch: 025/100 | Batch 100/469 | Gen/Dis Loss: -2.4762/-0.3209
Epoch: 025/100 | Batch 200/469 | Gen/Dis Loss: -0.8765/-0.0749
Epoch: 025/100 | Batch 300/469 | Gen/Dis Loss: -1.9202/-0.1480
Epoch: 025/100 | Batch 400/469 | Gen/Dis Loss: -1.4956/-0.0559
Time elapsed: 5.48 min
Epoch: 026/100 | Batch 000/469 | Gen/Dis Loss: -0.8660/-0.0154
Epoch: 026/100 | Batch 100/469 | Gen/Dis Loss: -0.5595/-0.0530
Epoch: 026/100 | Batch 200/469 | Gen/Dis Loss: -0.4411/-0.0221
Epoch: 026/100 | Batch 300/469 | Gen/Dis Loss: -0.9117/-0.0478
Epoch: 026/100 | Batch 400/469 | Gen/Dis Loss: -0.7948/-0.0565
Time elapsed: 5.70 min
Epoch: 027/100 | Batch 000/469 | Gen/Dis Loss: -0.3556/-0.0010
Epoch: 027/100 | Batch 100/469 | Gen/Dis Loss: -0.6643/-0.0375
Epoch: 027/100 | Batch 200/469 | Gen/Dis Loss: -0.8789/-0.0222
Epoch: 027/100 | Batch 300/469 | Gen/Dis Loss: -0.6258/-0.0236
Epoch: 027/100 | Batch 400/469 | Gen/Dis Loss: -0.6097/-0.0116
Time elapsed: 5.93 min
Epoch: 028/100 | Batch 000/469 | Gen/Dis Loss: -0.5124/-0.0151
Epoch: 028/100 | Batch 100/469 | Gen/Dis Loss: -0.3840/-0.0237
Epoch: 028/100 | Batch 200/469 | Gen/Dis Loss: -0.1995/-0.0381
Epoch: 028/100 | Batch 300/469 | Gen/Dis Loss: -0.1822/-0.0293
Epoch: 028/100 | Batch 400/469 | Gen/Dis Loss: -0.1177/-0.0334
Time elapsed: 6.15 min
Epoch: 029/100 | Batch 000/469 | Gen/Dis Loss: -0.1504/-0.0339
Epoch: 029/100 | Batch 100/469 | Gen/Dis Loss: -0.0851/-0.0310
Epoch: 029/100 | Batch 200/469 | Gen/Dis Loss: -0.0847/-0.0295
Epoch: 029/100 | Batch 300/469 | Gen/Dis Loss: -0.8884/-0.0660
Epoch: 029/100 | Batch 400/469 | Gen/Dis Loss: -1.3062/-0.0932
Time elapsed: 6.37 min
Epoch: 030/100 | Batch 000/469 | Gen/Dis Loss: -1.6727/-0.0356
Epoch: 030/100 | Batch 100/469 | Gen/Dis Loss: -0.9586/-0.1639
Epoch: 030/100 | Batch 200/469 | Gen/Dis Loss: -1.1727/-0.1016
Epoch: 030/100 | Batch 300/469 | Gen/Dis Loss: -1.7424/-0.1240
Epoch: 030/100 | Batch 400/469 | Gen/Dis Loss: -1.9941/-0.1225
Time elapsed: 6.60 min
Epoch: 031/100 | Batch 000/469 | Gen/Dis Loss: -2.3835/-0.0252
Epoch: 031/100 | Batch 100/469 | Gen/Dis Loss: -1.2459/-0.0767
Epoch: 031/100 | Batch 200/469 | Gen/Dis Loss: -0.9153/-0.1023
Epoch: 031/100 | Batch 300/469 | Gen/Dis Loss: -0.5369/-0.0466
Epoch: 031/100 | Batch 400/469 | Gen/Dis Loss: -0.8644/-0.0314
Time elapsed: 6.82 min
Epoch: 032/100 | Batch 000/469 | Gen/Dis Loss: -0.1392/-0.0423
Epoch: 032/100 | Batch 100/469 | Gen/Dis Loss: -0.2171/-0.0870
Epoch: 032/100 | Batch 200/469 | Gen/Dis Loss: -0.1663/-0.0909
Epoch: 032/100 | Batch 300/469 | Gen/Dis Loss: -0.1990/-0.0905
Epoch: 032/100 | Batch 400/469 | Gen/Dis Loss: -0.1221/-0.0977
Time elapsed: 7.02 min
Epoch: 033/100 | Batch 000/469 | Gen/Dis Loss: -0.2224/-0.1383
Epoch: 033/100 | Batch 100/469 | Gen/Dis Loss: -1.0020/-0.1380
Epoch: 033/100 | Batch 200/469 | Gen/Dis Loss: -0.4386/-0.0438
Epoch: 033/100 | Batch 300/469 | Gen/Dis Loss: -1.2815/-0.0513
Epoch: 033/100 | Batch 400/469 | Gen/Dis Loss: -2.0354/0.0270
Time elapsed: 7.23 min
Epoch: 034/100 | Batch 000/469 | Gen/Dis Loss: -2.7790/-0.1876
Epoch: 034/100 | Batch 100/469 | Gen/Dis Loss: -3.9126/-0.0100
Epoch: 034/100 | Batch 200/469 | Gen/Dis Loss: -3.3824/-0.0662
Epoch: 034/100 | Batch 300/469 | Gen/Dis Loss: -3.0964/-0.0396
Epoch: 034/100 | Batch 400/469 | Gen/Dis Loss: -1.0305/-0.1450
Time elapsed: 7.44 min
Epoch: 035/100 | Batch 000/469 | Gen/Dis Loss: -1.6022/-0.1637
Epoch: 035/100 | Batch 100/469 | Gen/Dis Loss: -1.5141/-0.0263
Epoch: 035/100 | Batch 200/469 | Gen/Dis Loss: -0.4072/-0.0307
Epoch: 035/100 | Batch 300/469 | Gen/Dis Loss: -0.2337/0.0006
Epoch: 035/100 | Batch 400/469 | Gen/Dis Loss: -0.3348/-0.0346
Time elapsed: 7.64 min
Epoch: 036/100 | Batch 000/469 | Gen/Dis Loss: -0.7794/-0.0191
Epoch: 036/100 | Batch 100/469 | Gen/Dis Loss: -0.4455/-0.0138
Epoch: 036/100 | Batch 200/469 | Gen/Dis Loss: -0.0616/-0.0118
Epoch: 036/100 | Batch 300/469 | Gen/Dis Loss: 0.0603/-0.0156
Epoch: 036/100 | Batch 400/469 | Gen/Dis Loss: 0.1056/-0.0125
Time elapsed: 7.86 min
Epoch: 037/100 | Batch 000/469 | Gen/Dis Loss: 0.0759/-0.0142
Epoch: 037/100 | Batch 100/469 | Gen/Dis Loss: 0.1198/-0.0079
Epoch: 037/100 | Batch 200/469 | Gen/Dis Loss: 0.0732/-0.0058
Epoch: 037/100 | Batch 300/469 | Gen/Dis Loss: 0.0837/-0.0093
Epoch: 037/100 | Batch 400/469 | Gen/Dis Loss: 0.1131/-0.0061
Time elapsed: 8.08 min
Epoch: 038/100 | Batch 000/469 | Gen/Dis Loss: 0.0629/-0.0076
Epoch: 038/100 | Batch 100/469 | Gen/Dis Loss: 0.0766/-0.0072
Epoch: 038/100 | Batch 200/469 | Gen/Dis Loss: 0.0196/-0.0092
Epoch: 038/100 | Batch 300/469 | Gen/Dis Loss: 0.1233/-0.0053
Epoch: 038/100 | Batch 400/469 | Gen/Dis Loss: 0.0524/-0.0143
Time elapsed: 8.30 min
Epoch: 039/100 | Batch 000/469 | Gen/Dis Loss: 0.0693/-0.0063
Epoch: 039/100 | Batch 100/469 | Gen/Dis Loss: -1.8572/-0.1096
Epoch: 039/100 | Batch 200/469 | Gen/Dis Loss: -0.9776/-0.0526
Epoch: 039/100 | Batch 300/469 | Gen/Dis Loss: -1.2697/-0.1387
Epoch: 039/100 | Batch 400/469 | Gen/Dis Loss: -1.3924/-0.1120
Time elapsed: 8.52 min
Epoch: 040/100 | Batch 000/469 | Gen/Dis Loss: -1.8005/-0.0139
Epoch: 040/100 | Batch 100/469 | Gen/Dis Loss: -1.1539/-0.1221
Epoch: 040/100 | Batch 200/469 | Gen/Dis Loss: -0.1513/-0.0415
Epoch: 040/100 | Batch 300/469 | Gen/Dis Loss: -2.2896/-0.0223
Epoch: 040/100 | Batch 400/469 | Gen/Dis Loss: -2.7501/-0.0865
Time elapsed: 8.74 min
Epoch: 041/100 | Batch 000/469 | Gen/Dis Loss: -0.8860/-0.0310
Epoch: 041/100 | Batch 100/469 | Gen/Dis Loss: -1.0508/-0.0627
Epoch: 041/100 | Batch 200/469 | Gen/Dis Loss: -1.2014/-0.2148
Epoch: 041/100 | Batch 300/469 | Gen/Dis Loss: -0.8424/-0.1071
Epoch: 041/100 | Batch 400/469 | Gen/Dis Loss: -0.9346/-0.0857
Time elapsed: 8.97 min
Epoch: 042/100 | Batch 000/469 | Gen/Dis Loss: -0.1562/-0.0464
Epoch: 042/100 | Batch 100/469 | Gen/Dis Loss: -0.2710/-0.1163
Epoch: 042/100 | Batch 200/469 | Gen/Dis Loss: -1.1959/0.0357
Epoch: 042/100 | Batch 300/469 | Gen/Dis Loss: -0.3887/-0.0603
Epoch: 042/100 | Batch 400/469 | Gen/Dis Loss: -0.1826/-0.2110
Time elapsed: 9.19 min
Epoch: 043/100 | Batch 000/469 | Gen/Dis Loss: -2.1735/0.0343
Epoch: 043/100 | Batch 100/469 | Gen/Dis Loss: -0.3043/-0.1190
Epoch: 043/100 | Batch 200/469 | Gen/Dis Loss: -0.6211/-0.0375
Epoch: 043/100 | Batch 300/469 | Gen/Dis Loss: -0.1019/-0.0665
Epoch: 043/100 | Batch 400/469 | Gen/Dis Loss: 0.0640/-0.0602
Time elapsed: 9.41 min
Epoch: 044/100 | Batch 000/469 | Gen/Dis Loss: 0.1020/-0.0610
Epoch: 044/100 | Batch 100/469 | Gen/Dis Loss: 0.0250/-0.0760
Epoch: 044/100 | Batch 200/469 | Gen/Dis Loss: 0.1465/-0.0735
Epoch: 044/100 | Batch 300/469 | Gen/Dis Loss: -0.1694/-0.0410
Epoch: 044/100 | Batch 400/469 | Gen/Dis Loss: 0.1538/-0.0760
Time elapsed: 9.63 min
Epoch: 045/100 | Batch 000/469 | Gen/Dis Loss: 0.1115/-0.0883
Epoch: 045/100 | Batch 100/469 | Gen/Dis Loss: 0.3155/-0.0957
Epoch: 045/100 | Batch 200/469 | Gen/Dis Loss: -0.0393/-0.0787
Epoch: 045/100 | Batch 300/469 | Gen/Dis Loss: 0.1622/-0.0675
Epoch: 045/100 | Batch 400/469 | Gen/Dis Loss: -0.1042/-0.0991
Time elapsed: 9.86 min
Epoch: 046/100 | Batch 000/469 | Gen/Dis Loss: 0.4376/-0.0861
Epoch: 046/100 | Batch 100/469 | Gen/Dis Loss: 0.6087/-0.0942
Epoch: 046/100 | Batch 200/469 | Gen/Dis Loss: 0.7479/-0.0922
Epoch: 046/100 | Batch 300/469 | Gen/Dis Loss: 0.8891/-0.1128
Epoch: 046/100 | Batch 400/469 | Gen/Dis Loss: 0.1424/-0.1214
Time elapsed: 10.08 min
Epoch: 047/100 | Batch 000/469 | Gen/Dis Loss: -0.0025/-0.0809
Epoch: 047/100 | Batch 100/469 | Gen/Dis Loss: 0.2443/-0.0811
Epoch: 047/100 | Batch 200/469 | Gen/Dis Loss: 0.5209/-0.1100
Epoch: 047/100 | Batch 300/469 | Gen/Dis Loss: 0.7354/-0.0890
Epoch: 047/100 | Batch 400/469 | Gen/Dis Loss: -0.1064/-0.0592
Time elapsed: 10.30 min
Epoch: 048/100 | Batch 000/469 | Gen/Dis Loss: -0.3177/-0.0673
Epoch: 048/100 | Batch 100/469 | Gen/Dis Loss: -0.0627/-0.0461
Epoch: 048/100 | Batch 200/469 | Gen/Dis Loss: -0.2542/-0.0726
Epoch: 048/100 | Batch 300/469 | Gen/Dis Loss: -0.2590/-0.0624
Epoch: 048/100 | Batch 400/469 | Gen/Dis Loss: -0.2193/-0.0638
Time elapsed: 10.52 min
Epoch: 049/100 | Batch 000/469 | Gen/Dis Loss: -0.1196/-0.0703
Epoch: 049/100 | Batch 100/469 | Gen/Dis Loss: -0.2319/-0.0537
Epoch: 049/100 | Batch 200/469 | Gen/Dis Loss: -0.0904/-0.0592
Epoch: 049/100 | Batch 300/469 | Gen/Dis Loss: -0.0149/-0.0473
Epoch: 049/100 | Batch 400/469 | Gen/Dis Loss: -0.1192/-0.1009
Time elapsed: 10.75 min
Epoch: 050/100 | Batch 000/469 | Gen/Dis Loss: -0.0885/-0.0917
Epoch: 050/100 | Batch 100/469 | Gen/Dis Loss: -0.0275/-0.0468
Epoch: 050/100 | Batch 200/469 | Gen/Dis Loss: -0.2900/-0.0846
Epoch: 050/100 | Batch 300/469 | Gen/Dis Loss: -0.4733/-0.0905
Epoch: 050/100 | Batch 400/469 | Gen/Dis Loss: -0.6236/-0.0697
Time elapsed: 10.97 min
Epoch: 051/100 | Batch 000/469 | Gen/Dis Loss: -0.3837/-0.2036
Epoch: 051/100 | Batch 100/469 | Gen/Dis Loss: -0.9772/-0.1589
Epoch: 051/100 | Batch 200/469 | Gen/Dis Loss: -0.8187/-0.1831
Epoch: 051/100 | Batch 300/469 | Gen/Dis Loss: -0.9445/-0.0874
Epoch: 051/100 | Batch 400/469 | Gen/Dis Loss: -1.4658/-0.0436
Time elapsed: 11.19 min
Epoch: 052/100 | Batch 000/469 | Gen/Dis Loss: -1.3324/-0.0003
Epoch: 052/100 | Batch 100/469 | Gen/Dis Loss: -1.0217/-0.0906
Epoch: 052/100 | Batch 200/469 | Gen/Dis Loss: -0.8700/-0.0581
Epoch: 052/100 | Batch 300/469 | Gen/Dis Loss: -0.5518/-0.0399
Epoch: 052/100 | Batch 400/469 | Gen/Dis Loss: -0.8691/-0.0255
Time elapsed: 11.41 min
Epoch: 053/100 | Batch 000/469 | Gen/Dis Loss: -0.5911/-0.0867
Epoch: 053/100 | Batch 100/469 | Gen/Dis Loss: -0.9219/-0.0518
Epoch: 053/100 | Batch 200/469 | Gen/Dis Loss: -0.8089/-0.0686
Epoch: 053/100 | Batch 300/469 | Gen/Dis Loss: -0.9910/0.0054
Epoch: 053/100 | Batch 400/469 | Gen/Dis Loss: -1.1288/-0.0324
Time elapsed: 11.64 min
Epoch: 054/100 | Batch 000/469 | Gen/Dis Loss: -1.4742/-0.0809
Epoch: 054/100 | Batch 100/469 | Gen/Dis Loss: -1.5307/-0.0613
Epoch: 054/100 | Batch 200/469 | Gen/Dis Loss: -2.2387/0.0006
Epoch: 054/100 | Batch 300/469 | Gen/Dis Loss: -0.7110/-0.0670
Epoch: 054/100 | Batch 400/469 | Gen/Dis Loss: -0.8786/-0.0557
Time elapsed: 11.86 min
Epoch: 055/100 | Batch 000/469 | Gen/Dis Loss: -0.6164/-0.0741
Epoch: 055/100 | Batch 100/469 | Gen/Dis Loss: -0.2841/-0.0537
Epoch: 055/100 | Batch 200/469 | Gen/Dis Loss: -1.0291/-0.0281
Epoch: 055/100 | Batch 300/469 | Gen/Dis Loss: -1.4945/-0.0017
Epoch: 055/100 | Batch 400/469 | Gen/Dis Loss: -1.1892/-0.0073
Time elapsed: 12.08 min
Epoch: 056/100 | Batch 000/469 | Gen/Dis Loss: -1.0694/-0.0216
Epoch: 056/100 | Batch 100/469 | Gen/Dis Loss: -1.1426/-0.0204
Epoch: 056/100 | Batch 200/469 | Gen/Dis Loss: -2.2945/-0.0640
Epoch: 056/100 | Batch 300/469 | Gen/Dis Loss: -1.1074/-0.0463
Epoch: 056/100 | Batch 400/469 | Gen/Dis Loss: -0.7330/-0.0245
Time elapsed: 12.30 min
Epoch: 057/100 | Batch 000/469 | Gen/Dis Loss: -0.5903/-0.0049
Epoch: 057/100 | Batch 100/469 | Gen/Dis Loss: -0.8674/-0.0973
Epoch: 057/100 | Batch 200/469 | Gen/Dis Loss: -0.5229/0.0020
Epoch: 057/100 | Batch 300/469 | Gen/Dis Loss: -0.2379/0.0131
Epoch: 057/100 | Batch 400/469 | Gen/Dis Loss: -0.4983/-0.0531
Time elapsed: 12.52 min
Epoch: 058/100 | Batch 000/469 | Gen/Dis Loss: -0.5298/-0.0460
Epoch: 058/100 | Batch 100/469 | Gen/Dis Loss: -1.3276/-0.0886
Epoch: 058/100 | Batch 200/469 | Gen/Dis Loss: -2.1372/-0.0680
Epoch: 058/100 | Batch 300/469 | Gen/Dis Loss: -1.3350/-0.0856
Epoch: 058/100 | Batch 400/469 | Gen/Dis Loss: -0.5794/-0.0047
Time elapsed: 12.75 min
Epoch: 059/100 | Batch 000/469 | Gen/Dis Loss: -1.5859/-0.0384
Epoch: 059/100 | Batch 100/469 | Gen/Dis Loss: -0.6838/-0.0324
Epoch: 059/100 | Batch 200/469 | Gen/Dis Loss: 0.1981/-0.0412
Epoch: 059/100 | Batch 300/469 | Gen/Dis Loss: 0.0314/-0.0073
Epoch: 059/100 | Batch 400/469 | Gen/Dis Loss: 0.2410/-0.0020
Time elapsed: 12.97 min
Epoch: 060/100 | Batch 000/469 | Gen/Dis Loss: -0.1257/0.0094
Epoch: 060/100 | Batch 100/469 | Gen/Dis Loss: -0.2361/-0.0420
Epoch: 060/100 | Batch 200/469 | Gen/Dis Loss: -0.0831/-0.0100
Epoch: 060/100 | Batch 300/469 | Gen/Dis Loss: 0.7063/-0.0007
Epoch: 060/100 | Batch 400/469 | Gen/Dis Loss: 0.6816/0.0040
Time elapsed: 13.19 min
Epoch: 061/100 | Batch 000/469 | Gen/Dis Loss: 0.3744/-0.0265
Epoch: 061/100 | Batch 100/469 | Gen/Dis Loss: 0.8184/-0.0424
Epoch: 061/100 | Batch 200/469 | Gen/Dis Loss: 0.2331/-0.0215
Epoch: 061/100 | Batch 300/469 | Gen/Dis Loss: 0.3921/-0.0157
Epoch: 061/100 | Batch 400/469 | Gen/Dis Loss: 0.2618/-0.0102
Time elapsed: 13.41 min
Epoch: 062/100 | Batch 000/469 | Gen/Dis Loss: 0.0962/-0.0024
Epoch: 062/100 | Batch 100/469 | Gen/Dis Loss: 0.1103/-0.0164
Epoch: 062/100 | Batch 200/469 | Gen/Dis Loss: 0.1266/-0.0099
Epoch: 062/100 | Batch 300/469 | Gen/Dis Loss: 0.3365/-0.0050
Epoch: 062/100 | Batch 400/469 | Gen/Dis Loss: 0.4718/-0.0315
Time elapsed: 13.63 min
Epoch: 063/100 | Batch 000/469 | Gen/Dis Loss: 0.6478/-0.0329
Epoch: 063/100 | Batch 100/469 | Gen/Dis Loss: 0.1355/-0.0061
Epoch: 063/100 | Batch 200/469 | Gen/Dis Loss: 0.0004/-0.0016
Epoch: 063/100 | Batch 300/469 | Gen/Dis Loss: -0.0462/-0.0090
Epoch: 063/100 | Batch 400/469 | Gen/Dis Loss: 0.1347/-0.0029
Time elapsed: 13.85 min
Epoch: 064/100 | Batch 000/469 | Gen/Dis Loss: 0.1120/-0.0024
Epoch: 064/100 | Batch 100/469 | Gen/Dis Loss: 0.1123/-0.0097
Epoch: 064/100 | Batch 200/469 | Gen/Dis Loss: -0.0541/0.0003
Epoch: 064/100 | Batch 300/469 | Gen/Dis Loss: -0.0160/-0.0031
Epoch: 064/100 | Batch 400/469 | Gen/Dis Loss: 0.0686/-0.0012
Time elapsed: 14.08 min
Epoch: 065/100 | Batch 000/469 | Gen/Dis Loss: 0.0104/-0.0068
Epoch: 065/100 | Batch 100/469 | Gen/Dis Loss: 0.0641/-0.0050
Epoch: 065/100 | Batch 200/469 | Gen/Dis Loss: 0.4558/-0.0234
Epoch: 065/100 | Batch 300/469 | Gen/Dis Loss: 0.7145/-0.1104
Epoch: 065/100 | Batch 400/469 | Gen/Dis Loss: 1.1978/-0.1029
Time elapsed: 14.30 min
Epoch: 066/100 | Batch 000/469 | Gen/Dis Loss: 0.1297/-0.0332
Epoch: 066/100 | Batch 100/469 | Gen/Dis Loss: 0.7369/-0.0627
Epoch: 066/100 | Batch 200/469 | Gen/Dis Loss: 0.9838/-0.0302
Epoch: 066/100 | Batch 300/469 | Gen/Dis Loss: 2.6508/-0.1789
Epoch: 066/100 | Batch 400/469 | Gen/Dis Loss: 0.7896/-0.1680
Time elapsed: 14.53 min
Epoch: 067/100 | Batch 000/469 | Gen/Dis Loss: 1.9006/0.0303
Epoch: 067/100 | Batch 100/469 | Gen/Dis Loss: 1.6707/-0.0282
Epoch: 067/100 | Batch 200/469 | Gen/Dis Loss: -0.1290/-0.0148
Epoch: 067/100 | Batch 300/469 | Gen/Dis Loss: -0.7942/-0.0258
Epoch: 067/100 | Batch 400/469 | Gen/Dis Loss: -0.4003/-0.0190
Time elapsed: 14.73 min
Epoch: 068/100 | Batch 000/469 | Gen/Dis Loss: -0.6044/-0.0053
Epoch: 068/100 | Batch 100/469 | Gen/Dis Loss: -0.6929/-0.0031
Epoch: 068/100 | Batch 200/469 | Gen/Dis Loss: -0.4085/0.0064
Epoch: 068/100 | Batch 300/469 | Gen/Dis Loss: -0.5156/-0.0066
Epoch: 068/100 | Batch 400/469 | Gen/Dis Loss: 0.1810/0.0041
Time elapsed: 14.93 min
Epoch: 069/100 | Batch 000/469 | Gen/Dis Loss: -0.2750/-0.0059
Epoch: 069/100 | Batch 100/469 | Gen/Dis Loss: -0.0665/-0.0011
Epoch: 069/100 | Batch 200/469 | Gen/Dis Loss: -0.0914/-0.0007
Epoch: 069/100 | Batch 300/469 | Gen/Dis Loss: -0.0312/-0.0001
Epoch: 069/100 | Batch 400/469 | Gen/Dis Loss: -0.0557/-0.0002
Time elapsed: 15.13 min
Epoch: 070/100 | Batch 000/469 | Gen/Dis Loss: -0.0603/0.0003
Epoch: 070/100 | Batch 100/469 | Gen/Dis Loss: 0.0181/0.0018
Epoch: 070/100 | Batch 200/469 | Gen/Dis Loss: -0.0190/0.0002
Epoch: 070/100 | Batch 300/469 | Gen/Dis Loss: -0.0765/0.0006
Epoch: 070/100 | Batch 400/469 | Gen/Dis Loss: -0.2264/-0.0128
Time elapsed: 15.33 min
Epoch: 071/100 | Batch 000/469 | Gen/Dis Loss: -0.0976/-0.0021
Epoch: 071/100 | Batch 100/469 | Gen/Dis Loss: -0.2573/0.0020
Epoch: 071/100 | Batch 200/469 | Gen/Dis Loss: 0.0093/-0.0019
Epoch: 071/100 | Batch 300/469 | Gen/Dis Loss: 0.0989/-0.0047
Epoch: 071/100 | Batch 400/469 | Gen/Dis Loss: -0.1550/-0.0051
Time elapsed: 15.54 min
Epoch: 072/100 | Batch 000/469 | Gen/Dis Loss: -0.0617/-0.0015
Epoch: 072/100 | Batch 100/469 | Gen/Dis Loss: -0.0673/-0.0039
Epoch: 072/100 | Batch 200/469 | Gen/Dis Loss: -0.1668/-0.0009
Epoch: 072/100 | Batch 300/469 | Gen/Dis Loss: -0.1308/-0.0009
Epoch: 072/100 | Batch 400/469 | Gen/Dis Loss: 0.5936/-0.0459
Time elapsed: 15.76 min
Epoch: 073/100 | Batch 000/469 | Gen/Dis Loss: 0.4555/-0.0955
Epoch: 073/100 | Batch 100/469 | Gen/Dis Loss: -0.5352/-0.0407
Epoch: 073/100 | Batch 200/469 | Gen/Dis Loss: -1.0010/-0.0430
Epoch: 073/100 | Batch 300/469 | Gen/Dis Loss: -0.3312/-0.0211
Epoch: 073/100 | Batch 400/469 | Gen/Dis Loss: -0.6744/-0.0705
Time elapsed: 15.98 min
Epoch: 074/100 | Batch 000/469 | Gen/Dis Loss: -0.2362/-0.0283
Epoch: 074/100 | Batch 100/469 | Gen/Dis Loss: -0.5404/0.0122
Epoch: 074/100 | Batch 200/469 | Gen/Dis Loss: -0.0699/0.0050
Epoch: 074/100 | Batch 300/469 | Gen/Dis Loss: -0.3420/-0.0109
Epoch: 074/100 | Batch 400/469 | Gen/Dis Loss: -0.2500/-0.0434
Time elapsed: 16.20 min
Epoch: 075/100 | Batch 000/469 | Gen/Dis Loss: 0.2550/-0.0134
Epoch: 075/100 | Batch 100/469 | Gen/Dis Loss: -0.0334/-0.0154
Epoch: 075/100 | Batch 200/469 | Gen/Dis Loss: -0.1309/-0.0169
Epoch: 075/100 | Batch 300/469 | Gen/Dis Loss: -0.1829/-0.0050
Epoch: 075/100 | Batch 400/469 | Gen/Dis Loss: 0.0190/-0.0159
Time elapsed: 16.42 min
Epoch: 076/100 | Batch 000/469 | Gen/Dis Loss: -0.0615/-0.0070
Epoch: 076/100 | Batch 100/469 | Gen/Dis Loss: -0.0425/-0.0027
Epoch: 076/100 | Batch 200/469 | Gen/Dis Loss: -0.2873/-0.0004
Epoch: 076/100 | Batch 300/469 | Gen/Dis Loss: -0.2644/-0.0015
Epoch: 076/100 | Batch 400/469 | Gen/Dis Loss: 0.0010/-0.0117
Time elapsed: 16.64 min
Epoch: 077/100 | Batch 000/469 | Gen/Dis Loss: -0.4785/-0.0143
Epoch: 077/100 | Batch 100/469 | Gen/Dis Loss: 0.2545/-0.0538
Epoch: 077/100 | Batch 200/469 | Gen/Dis Loss: 1.1126/-0.0420
Epoch: 077/100 | Batch 300/469 | Gen/Dis Loss: -0.0171/-0.0281
Epoch: 077/100 | Batch 400/469 | Gen/Dis Loss: -0.2377/-0.0282
Time elapsed: 16.86 min
Epoch: 078/100 | Batch 000/469 | Gen/Dis Loss: -1.0293/-0.0400
Epoch: 078/100 | Batch 100/469 | Gen/Dis Loss: -0.6561/-0.0403
Epoch: 078/100 | Batch 200/469 | Gen/Dis Loss: -0.3585/0.0199
Epoch: 078/100 | Batch 300/469 | Gen/Dis Loss: -0.2837/0.0207
Epoch: 078/100 | Batch 400/469 | Gen/Dis Loss: -0.5526/-0.0081
Time elapsed: 17.08 min
Epoch: 079/100 | Batch 000/469 | Gen/Dis Loss: -0.2561/-0.0348
Epoch: 079/100 | Batch 100/469 | Gen/Dis Loss: -0.5544/0.0026
Epoch: 079/100 | Batch 200/469 | Gen/Dis Loss: -0.6737/-0.0098
Epoch: 079/100 | Batch 300/469 | Gen/Dis Loss: -0.1180/-0.0130
Epoch: 079/100 | Batch 400/469 | Gen/Dis Loss: -0.1299/0.0001
Time elapsed: 17.30 min
Epoch: 080/100 | Batch 000/469 | Gen/Dis Loss: -0.4765/-0.0191
Epoch: 080/100 | Batch 100/469 | Gen/Dis Loss: -0.1213/-0.0290
Epoch: 080/100 | Batch 200/469 | Gen/Dis Loss: -0.1815/0.0004
Epoch: 080/100 | Batch 300/469 | Gen/Dis Loss: 0.0792/-0.0099
Epoch: 080/100 | Batch 400/469 | Gen/Dis Loss: 0.0294/0.0005
Time elapsed: 17.52 min
Epoch: 081/100 | Batch 000/469 | Gen/Dis Loss: -0.0135/-0.0124
Epoch: 081/100 | Batch 100/469 | Gen/Dis Loss: -0.1607/-0.0117
Epoch: 081/100 | Batch 200/469 | Gen/Dis Loss: -0.0133/-0.0067
Epoch: 081/100 | Batch 300/469 | Gen/Dis Loss: -0.1880/-0.0087
Epoch: 081/100 | Batch 400/469 | Gen/Dis Loss: 0.0065/-0.0080
Time elapsed: 17.75 min
Epoch: 082/100 | Batch 000/469 | Gen/Dis Loss: 0.1546/-0.0072
Epoch: 082/100 | Batch 100/469 | Gen/Dis Loss: -0.0983/-0.0176
Epoch: 082/100 | Batch 200/469 | Gen/Dis Loss: -0.0293/-0.0161
Epoch: 082/100 | Batch 300/469 | Gen/Dis Loss: -0.0014/-0.0127
Epoch: 082/100 | Batch 400/469 | Gen/Dis Loss: 0.6860/-0.0461
Time elapsed: 17.97 min
Epoch: 083/100 | Batch 000/469 | Gen/Dis Loss: 0.1244/-0.0502
Epoch: 083/100 | Batch 100/469 | Gen/Dis Loss: 0.2871/-0.0777
Epoch: 083/100 | Batch 200/469 | Gen/Dis Loss: 0.2586/-0.0511
Epoch: 083/100 | Batch 300/469 | Gen/Dis Loss: 0.7882/-0.0167
Epoch: 083/100 | Batch 400/469 | Gen/Dis Loss: -0.6637/0.0116
Time elapsed: 18.19 min
Epoch: 084/100 | Batch 000/469 | Gen/Dis Loss: -0.3545/-0.0194
Epoch: 084/100 | Batch 100/469 | Gen/Dis Loss: -0.5852/-0.0206
Epoch: 084/100 | Batch 200/469 | Gen/Dis Loss: -0.7705/0.0064
Epoch: 084/100 | Batch 300/469 | Gen/Dis Loss: -0.5049/-0.0083
Epoch: 084/100 | Batch 400/469 | Gen/Dis Loss: 0.2705/0.0011
Time elapsed: 18.40 min
Epoch: 085/100 | Batch 000/469 | Gen/Dis Loss: 0.2000/-0.0048
Epoch: 085/100 | Batch 100/469 | Gen/Dis Loss: 0.0808/-0.0103
Epoch: 085/100 | Batch 200/469 | Gen/Dis Loss: 0.2059/-0.0094
Epoch: 085/100 | Batch 300/469 | Gen/Dis Loss: -0.0031/-0.0018
Epoch: 085/100 | Batch 400/469 | Gen/Dis Loss: -0.0381/-0.0005
Time elapsed: 18.60 min
Epoch: 086/100 | Batch 000/469 | Gen/Dis Loss: 0.1286/-0.0044
Epoch: 086/100 | Batch 100/469 | Gen/Dis Loss: 0.0331/-0.0044
Epoch: 086/100 | Batch 200/469 | Gen/Dis Loss: 0.1965/-0.0048
Epoch: 086/100 | Batch 300/469 | Gen/Dis Loss: -0.0337/-0.0016
Epoch: 086/100 | Batch 400/469 | Gen/Dis Loss: -0.0184/-0.0004
Time elapsed: 18.80 min
Epoch: 087/100 | Batch 000/469 | Gen/Dis Loss: -0.0462/-0.0016
Epoch: 087/100 | Batch 100/469 | Gen/Dis Loss: -0.0760/-0.0037
Epoch: 087/100 | Batch 200/469 | Gen/Dis Loss: 0.0399/-0.0049
Epoch: 087/100 | Batch 300/469 | Gen/Dis Loss: 0.0365/0.0037
Epoch: 087/100 | Batch 400/469 | Gen/Dis Loss: -0.1306/-0.0062
Time elapsed: 19.00 min
Epoch: 088/100 | Batch 000/469 | Gen/Dis Loss: -0.0738/-0.0088
Epoch: 088/100 | Batch 100/469 | Gen/Dis Loss: -0.0802/-0.0042
Epoch: 088/100 | Batch 200/469 | Gen/Dis Loss: -0.0822/-0.0090
Epoch: 088/100 | Batch 300/469 | Gen/Dis Loss: -0.1203/-0.0012
Epoch: 088/100 | Batch 400/469 | Gen/Dis Loss: -0.1172/-0.0026
Time elapsed: 19.20 min
Epoch: 089/100 | Batch 000/469 | Gen/Dis Loss: -0.0263/-0.0020
Epoch: 089/100 | Batch 100/469 | Gen/Dis Loss: -0.0841/-0.0101
Epoch: 089/100 | Batch 200/469 | Gen/Dis Loss: -0.1369/-0.0121
Epoch: 089/100 | Batch 300/469 | Gen/Dis Loss: 0.1396/-0.0129
Epoch: 089/100 | Batch 400/469 | Gen/Dis Loss: 1.0665/-0.0987
Time elapsed: 19.40 min
Epoch: 090/100 | Batch 000/469 | Gen/Dis Loss: 1.4815/-0.0318
Epoch: 090/100 | Batch 100/469 | Gen/Dis Loss: 0.0725/-0.1139
Epoch: 090/100 | Batch 200/469 | Gen/Dis Loss: 2.0467/-0.1155
Epoch: 090/100 | Batch 300/469 | Gen/Dis Loss: 2.3618/-0.0439
Epoch: 090/100 | Batch 400/469 | Gen/Dis Loss: 0.2455/-0.0782
Time elapsed: 19.60 min
Epoch: 091/100 | Batch 000/469 | Gen/Dis Loss: -0.3347/0.0024
Epoch: 091/100 | Batch 100/469 | Gen/Dis Loss: -0.3745/-0.0038
Epoch: 091/100 | Batch 200/469 | Gen/Dis Loss: -0.0828/-0.0351
Epoch: 091/100 | Batch 300/469 | Gen/Dis Loss: -0.6020/-0.0001
Epoch: 091/100 | Batch 400/469 | Gen/Dis Loss: -0.1889/-0.0489
Time elapsed: 19.80 min
Epoch: 092/100 | Batch 000/469 | Gen/Dis Loss: -0.3254/-0.0110
Epoch: 092/100 | Batch 100/469 | Gen/Dis Loss: 0.0726/-0.0020
Epoch: 092/100 | Batch 200/469 | Gen/Dis Loss: 0.0384/0.0016
Epoch: 092/100 | Batch 300/469 | Gen/Dis Loss: -0.0508/-0.0077
Epoch: 092/100 | Batch 400/469 | Gen/Dis Loss: 0.1877/-0.0063
Time elapsed: 19.99 min
Epoch: 093/100 | Batch 000/469 | Gen/Dis Loss: 0.0010/0.0017
Epoch: 093/100 | Batch 100/469 | Gen/Dis Loss: 0.0229/-0.0026
Epoch: 093/100 | Batch 200/469 | Gen/Dis Loss: -0.1199/-0.0056
Epoch: 093/100 | Batch 300/469 | Gen/Dis Loss: -0.1033/-0.0058
Epoch: 093/100 | Batch 400/469 | Gen/Dis Loss: -0.0920/-0.0029
Time elapsed: 20.19 min
Epoch: 094/100 | Batch 000/469 | Gen/Dis Loss: -0.1888/-0.0027
Epoch: 094/100 | Batch 100/469 | Gen/Dis Loss: -0.0180/-0.0011
Epoch: 094/100 | Batch 200/469 | Gen/Dis Loss: -0.1378/0.0004
Epoch: 094/100 | Batch 300/469 | Gen/Dis Loss: -0.1408/-0.0006
Epoch: 094/100 | Batch 400/469 | Gen/Dis Loss: -0.1772/-0.0040
Time elapsed: 20.39 min
Epoch: 095/100 | Batch 000/469 | Gen/Dis Loss: -0.3192/-0.0059
Epoch: 095/100 | Batch 100/469 | Gen/Dis Loss: 0.1092/-0.0199
Epoch: 095/100 | Batch 200/469 | Gen/Dis Loss: -0.8190/-0.0505
Epoch: 095/100 | Batch 300/469 | Gen/Dis Loss: -1.4537/-0.1348
Epoch: 095/100 | Batch 400/469 | Gen/Dis Loss: -1.2839/-0.0552
Time elapsed: 20.59 min
Epoch: 096/100 | Batch 000/469 | Gen/Dis Loss: -2.2877/-0.0374
Epoch: 096/100 | Batch 100/469 | Gen/Dis Loss: -1.9977/-0.0345
Epoch: 096/100 | Batch 200/469 | Gen/Dis Loss: -1.2651/-0.0732
Epoch: 096/100 | Batch 300/469 | Gen/Dis Loss: -0.2708/-0.0259
Epoch: 096/100 | Batch 400/469 | Gen/Dis Loss: 0.0806/-0.0034
Time elapsed: 20.79 min
Epoch: 097/100 | Batch 000/469 | Gen/Dis Loss: 0.0644/-0.0152
Epoch: 097/100 | Batch 100/469 | Gen/Dis Loss: 0.2800/-0.0039
Epoch: 097/100 | Batch 200/469 | Gen/Dis Loss: -0.1104/-0.0107
Epoch: 097/100 | Batch 300/469 | Gen/Dis Loss: 0.0570/-0.0085
Epoch: 097/100 | Batch 400/469 | Gen/Dis Loss: -0.1557/-0.0142
Time elapsed: 20.99 min
Epoch: 098/100 | Batch 000/469 | Gen/Dis Loss: -0.1008/-0.0084
Epoch: 098/100 | Batch 100/469 | Gen/Dis Loss: -0.0895/-0.0114
Epoch: 098/100 | Batch 200/469 | Gen/Dis Loss: -0.0015/-0.0081
Epoch: 098/100 | Batch 300/469 | Gen/Dis Loss: -0.2192/-0.0051
Epoch: 098/100 | Batch 400/469 | Gen/Dis Loss: -0.0046/-0.0065
Time elapsed: 21.20 min
Epoch: 099/100 | Batch 000/469 | Gen/Dis Loss: -0.0141/-0.0044
Epoch: 099/100 | Batch 100/469 | Gen/Dis Loss: -0.0081/-0.0092
Epoch: 099/100 | Batch 200/469 | Gen/Dis Loss: -0.1231/-0.0125
Epoch: 099/100 | Batch 300/469 | Gen/Dis Loss: -0.1279/-0.0022
Epoch: 099/100 | Batch 400/469 | Gen/Dis Loss: -0.1377/-0.0124
Time elapsed: 21.42 min
Epoch: 100/100 | Batch 000/469 | Gen/Dis Loss: -0.1776/-0.0067
Epoch: 100/100 | Batch 100/469 | Gen/Dis Loss: -0.0924/-0.0051
Epoch: 100/100 | Batch 200/469 | Gen/Dis Loss: 0.5641/-0.0004
Epoch: 100/100 | Batch 300/469 | Gen/Dis Loss: 0.5127/-0.0377
Epoch: 100/100 | Batch 400/469 | Gen/Dis Loss: 0.5550/-0.0404
Time elapsed: 21.64 min
Total Training Time: 21.64 min

Evaluation

In [7]:
%matplotlib inline
import matplotlib.pyplot as plt
In [8]:
ax1 = plt.subplot(1, 1, 1)
ax1.plot(range(len(gener_costs)), gener_costs, label='Generator loss')
ax1.plot(range(len(discr_costs)), discr_costs, label='Discriminator loss')
ax1.set_xlabel('Iterations')
ax1.set_ylabel('Loss')
ax1.legend()

###################
# Set scond x-axis
ax2 = ax1.twiny()
newlabel = list(range(NUM_EPOCHS+1))
iter_per_epoch = len(train_loader)
newpos = [e*iter_per_epoch for e in newlabel]

ax2.set_xticklabels(newlabel[::10])
ax2.set_xticks(newpos[::10])

ax2.xaxis.set_ticks_position('bottom')
ax2.xaxis.set_label_position('bottom')
ax2.spines['bottom'].set_position(('outward', 45))
ax2.set_xlabel('Epochs')
ax2.set_xlim(ax1.get_xlim())
###################

plt.show()
In [9]:
##########################
### VISUALIZATION
##########################


model.eval()
# Make new images
z = torch.zeros((5, LATENT_DIM)).uniform_(-1.0, 1.0).to(device)
generated_features = model.generator_forward(z)
imgs = generated_features.view(-1, 28, 28)

fig, axes = plt.subplots(nrows=1, ncols=5, figsize=(20, 2.5))


for i, ax in enumerate(axes):
    axes[i].imshow(imgs[i].to(torch.device('cpu')).detach(), cmap='binary')