In [2]:
import os
import glob
import tensorflow as tf
import numpy as np
from keras import layers, models, optimizers, losses, metrics, regularizers
from keras.callbacks import Callback, EarlyStopping, ReduceLROnPlateau, ModelCheckpoint, TensorBoard
from keras.preprocessing.sequence import pad_sequences
import keras.backend as K 
from keras.engine.topology import Container


/home/duke/.conda/envs/heads/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.

In [3]:
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib inline
plt.rcParams['figure.figsize'] = (15, 12) # set default size of plots

In [6]:
from keras.datasets import mnist

In [7]:
(x_train, y_train), (x_test, y_test) = mnist.load_data()

In [8]:
y_train = np.squeeze(y_train)
y_test = np.squeeze(y_test)

In [9]:
classes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
num_classes = len(classes)
samples_per_class = 10
for y, cls in enumerate(classes):
    idxs = np.flatnonzero(y_train == y)
    idxs = np.random.choice(idxs, samples_per_class, replace=False)
    for i, idx in enumerate(idxs):
        plt_idx = i * num_classes + y + 1
        plt.subplot(samples_per_class, num_classes, plt_idx)
        plt.imshow(x_train[idx].astype('uint8'), cmap='gray')
        plt.axis('off')
        if i == 0:
            plt.title(cls)
plt.show()



In [10]:
class GradNorm(layers.Layer):
    def __init__(self, **kwargs):
        super(GradNorm, self).__init__(**kwargs)

    def build(self, input_shapes):
        super(GradNorm, self).build(input_shapes)

    def call(self, inputs):
        target, image = inputs
        
        # Впишите код сюда
        
        return None # Не забудьту заменить

    def compute_output_shape(self, input_shapes):
        return (input_shapes[1][0], 1)

In [11]:
class MixtureLayer(layers.Layer):
    def __init__(self, **kwargs):
        super(MixtureLayer, self).__init__(**kwargs)

    def build(self, input_shapes):
        super(MixtureLayer, self).build(input_shapes)

    def call(self, inputs):
        image_real, image_fake = inputs

        # Впишите код сюда
        
        return None # Не забудьту заменить 

    def compute_output_shape(self, input_shapes):
        return input_shapes[0]

In [12]:
class WasserstainLayer(layers.Layer):
    def __init__(self, **kwargs):
        super(WasserstainLayer, self).__init__(**kwargs)

    def build(self, input_shapes):
        super(WasserstainLayer, self).build(input_shapes)

    def call(self, inputs):
        score_real, score_fake = inputs
        
        # Впишите код сюда
        
        return None # Не забудьту заменить на верное значние

    def compute_output_shape(self, input_shapes):
        return input_shapes[0]

In [13]:
def build_classifier():
    img_input = layers.Input(shape=(28, 28, 1))
    x = layers.Conv2D(64, kernel_size=4, strides=2, padding='same')(img_input)
    x = InstanceNormalization(axis=-1)(x)
    x = layers.LeakyReLU()(x)
    x = layers.Conv2D(64, kernel_size=4, strides=1, padding='same')(x)
    x = InstanceNormalization(axis=-1)(x)
    x = layers.LeakyReLU()(x)
    x = layers.Conv2D(128, kernel_size=4, strides=2, padding='same')(x)
    x = InstanceNormalization(axis=-1)(x)
    x = layers.LeakyReLU()(x)
    x = layers.Conv2D(128, kernel_size=4, strides=1, padding='same')(x)
    x = InstanceNormalization(axis=-1)(x)
    x = layers.LeakyReLU()(x)
    x = layers.Conv2D(256, kernel_size=4, strides=2, padding='same')(x)
    x = InstanceNormalization(axis=-1)(x)
    x = layers.LeakyReLU()(x)
    
    x = layers.Conv2D(1, kernel_size=3, strides=1, padding='same')(x)
    
    fake_detector_output = layers.GlobalAveragePooling2D(name='fake_detector_output')(x)
    
    return models.Model(img_input, fake_detector_output, 
                        name='classifier')

In [14]:
def build_critic():
    img_input_real = layers.Input(shape=(28, 28, 1))
    img_input_fake = layers.Input(shape=(28, 28, 1))
    
    classifier = build_classifier()
    
    score_real = classifier(img_input_real)
    score_fake = classifier(img_input_fake)
    
    wasserstain_loss = WasserstainLayer(name='wasserstain_loss')([score_real, score_fake])
    
    img_mixture = MixtureLayer()([img_input_real, img_input_fake])
    
    score_mix = classifier([img_mixture])
    grad_norm = GradNorm(name='grad_norm')([score_mix, img_mixture])
    
    return models.Model([img_input_real, img_input_fake], [wasserstain_loss, grad_norm]), classifier

In [15]:
def multiple_loss(y_true, y_pred):
    return K.mean(y_true*y_pred, axis=-1)

In [16]:
def wgan_penalty_loss(y_true, y_pred):
    #https://arxiv.org/pdf/1709.08894.pdf
    return K.mean(K.square(K.maximum(0., y_pred - y_true)), axis=-1)

In [17]:
K.clear_session()
with tf.variable_scope('discriminator'):
    critic, classifier = build_critic()

    adam = optimizers.Adam(lr=0.0001, beta_1=0.5, beta_2=0.99)
    classifier.compile(adam, loss=[multiple_loss])
    critic.compile(adam, 
                  loss=[multiple_loss, wgan_penalty_loss],
                  metrics=['acc'], loss_weights=[1, 10])

А теперь генератор


In [18]:
def build_generator():
    z_input = layers.Input(shape=(128,))
    
    x = layers.Dense(512)(z_input)
    x = layers.BatchNormalization()(x)
    x = layers.ELU()(x)
    x = layers.Dense(7 * 7 * 64)(x)
    x = layers.ELU()(x)
    x = layers.Reshape((7, 7, 64))(x)
    
    x = layers.Conv2D(128, (3, 3), padding='same')(x)
    x = layers.ELU()(x)
    x = layers.UpSampling2D()(x)
    x = layers.Conv2D(128, (3, 3), padding='same')(x)
    x = layers.ELU()(x)
    
    x = layers.Conv2D(256, (3, 3), padding='same')(x)
    x = layers.ELU()(x)
    x = layers.UpSampling2D()(x)
    x = layers.Conv2D(256, (3, 3), padding='same')(x)
    x = layers.ELU()(x)
    
    x = layers.Conv2D(1, (3, 3), padding='same', activation='tanh')(x)
    
    return models.Model(z_input, x)

In [19]:
def build_gan_generator(classifier):
    z_input = layers.Input(shape=(128,))
    
    generator = build_generator()
    
    output = generator(z_input)
    
    score = classifier(output)
    
    return models.Model(z_input, score), generator

In [20]:
with tf.variable_scope('generator'):
    classifier.trainable = False
    gan_generator, generator = build_gan_generator(classifier)
    adam = optimizers.Adam(lr=0.0001, beta_1=0.5, beta_2=0.99)
    gan_generator.compile(adam, 
                  loss=[multiple_loss],
                  metrics=['acc'])
    classifier.trainable = True

In [21]:
import threading
class threadsafe_iter():
    """Takes an iterator/generator and makes it thread-safe by
    serializing call to the `next` method of given iterator/generator.
    """

    def __init__(self, it):
        self.it = it
        self.lock = threading.Lock()

    def __iter__(self):
        return self

    def __next__(self):
        with self.lock:
            return next(self.it)


def threadsafe_generator(f):

    def g(*a, **kw):
        return threadsafe_iter(f(*a, **kw))

    return g

In [22]:
@threadsafe_generator
def geterate_batch_critic(data, batch_size=128):
    data = (data - 127.5) / 127.5
    while True:
        np.random.shuffle(data)
        bathes = np.array_split(data, len(data) // batch_size)
    
        for batch in bathes:
            z = np.random.rand(len(batch), 128).astype(np.float32)

            generated_frames = generator.predict([z])

            was_label = np.array([1]*len(batch))
            norm_val = np.array([1]*len(batch))

            yield [np.expand_dims(batch, -1), generated_frames], [was_label, norm_val]

In [23]:
@threadsafe_generator
def geterate_batch_generator(batch_size=128):
    while True:
        z = np.random.rand(batch_size, 128).astype(np.float32)
        score = np.array([-1] * batch_size)
        yield z, score

In [154]:
train_gen_critic = geterate_batch_critic(x_train, 128)
train_gen_generator = geterate_batch_generator(128)

Тренировочный цикл


In [156]:
from keras import callbacks as cbks, models
# noinspection PyProtectedMember
def fit_generator(gan_generator : models.Model,
                  gan_critic : models.Model,
                  gen_generator,
                  critic_generator,
                  steps_per_epoch=None,
                  n_gen = 10,
                  epochs=256,
                  verbose=1,
                  gen_callbacks=None,
                  critic_callbacks=None,
                  initial_epoch=0):
    k = 0
    epoch = initial_epoch

    if steps_per_epoch is None:
        ValueError('`steps_per_epoch=None` is only valid for a'
                   ' generator based on the `keras.utils.Sequence`'
                   ' class. Please specify `steps_per_epoch` or use'
                   ' the `keras.utils.Sequence` class.')

    # Prepare display labels.
    out_labels = [f'generator_{m}' for m in gan_generator._get_deduped_metrics_names()] + \
                 [f'critic_{m}' for m in gan_critic._get_deduped_metrics_names()]
    callback_metrics = out_labels 

    gen_callback_model, gen_callbacks = prepare_callbacks(gan_generator,
                                                          gen_callbacks,
                                                          callback_metrics,
                                                          epochs,
                                                          steps_per_epoch,
                                                          verbose)
    gen_callbacks.on_train_begin()

    critic_callback_model, critic_callbacks = prepare_callbacks(gan_critic,
                                                                critic_callbacks,
                                                                callback_metrics,
                                                                epochs,
                                                                steps_per_epoch,
                                                                verbose)
    gen_callbacks.on_train_begin()
    critic_callbacks.on_train_begin()

    gen_callback_model.stop_training = False
    critic_callback_model.stop_training = False
    if not hasattr(gen_callback_model, 'log_values'):
        gen_callback_model.log_values = []
    if not  hasattr(critic_callback_model,'log_values'):
        critic_callback_model.log_values = []
    while epoch < epochs:
        gen_callbacks.on_epoch_begin(epoch)
        critic_callbacks.on_epoch_begin(epoch)

        steps_done = 0
        batch_index = 0
        
        gen_outs = []
        while steps_done < steps_per_epoch:
            generator_output = next(critic_generator)

            sample_weight, x, y = validate_output(generator_output)

            # build batch logs
            batch_logs = {}
            if isinstance(x, list):
                batch_size = x[0].shape[0]
            elif isinstance(x, dict):
                batch_size = list(x.values())[0].shape[0]
            else:
                batch_size = x.shape[0]

            batch_logs['batch'] = batch_index
            batch_logs['size'] = batch_size

            critic_callbacks.on_batch_begin(batch_index, batch_logs)
            critic_outs = gan_critic.train_on_batch(x, y)

            
            if batch_index % n_gen == 0 or batch_index != 0:
                gen_callbacks.on_batch_begin(batch_index, batch_logs)
                
                gen_generator_output = next(gen_generator)
                _, x_gen, y_gen = validate_output(gen_generator_output)

                gen_outs = gan_generator.train_on_batch(x_gen, y_gen)

            outs = gen_outs + critic_outs
            for l, o in zip(out_labels, outs):
                batch_logs[l] = o

            gen_callbacks.on_batch_end(batch_index, batch_logs)
            critic_callbacks.on_batch_end(batch_index, batch_logs)

            # Construct epoch logs.
            epoch_logs = {}
            batch_index += 1
            steps_done += 1

            if gen_callback_model.stop_training:
                break
            if critic_callback_model.stop_training:
                break

        gen_callbacks.on_epoch_end(epoch, epoch_logs)
        critic_callbacks.on_epoch_end(epoch, epoch_logs)

        epoch += 1
        if critic_callback_model.stop_training:
            break
        if gen_callback_model.stop_training:
            break

    gen_callbacks.on_train_end()
    critic_callbacks.on_train_end()
    return critic_callback_model.history, gen_callback_model.history


def validate_output(generator_output):
    if len(generator_output) == 2:
        x, y = generator_output
        sample_weight = None
    else:
        raise ValueError('Output of generator should be '
                         'a tuple `(x, y, sample_weight)` '
                         'or `(x, y)`. Found: ' +
                         str(generator_output))
    return sample_weight, x, y


def prepare_callbacks(model, callbacks, callback_metrics, epochs, steps_per_epoch, verbose):
    # prepare callbacks
    model.history = cbks.History()
    callbacks = [cbks.BaseLogger()] + (callbacks or []) + [model.history]
    if verbose:
        callbacks += [cbks.ProgbarLogger(count_mode='steps')]
    callbacks = cbks.CallbackList(callbacks)
    if hasattr(model, 'callback_model'):
        callback_model = model.callback_model
    else:
        callback_model = model
    callbacks.set_model(callback_model)
    callbacks.set_params({
        'epochs': epochs,
        'steps': steps_per_epoch,
        'verbose': verbose,
        'metrics': callback_metrics,
    })
    return callback_model, callbacks

In [160]:
from keras.callbacks import Callback
j = None
class SaveImageSamplesCallback(Callback):
    def __init__(self, gen, log_dir='./logs'):
        super(SaveImageSamplesCallback, self).__init__()
        if K.backend() != 'tensorflow':
            raise RuntimeError('TensorBoard callback only works ''with the TensorFlow backend.')
        self.log_dir = log_dir
        self.gen = gen
        
    def set_model(self, model):
        self.model = model.layers[1]
        self.sess = K.get_session()
        self.placeholder = tf.placeholder(tf.float32, shape=(None,28,28,1))
        self.summary_image = tf.summary.image('results', self.placeholder, max_outputs=3)
        self.writer = tf.summary.FileWriter(self.log_dir)
   
    def on_epoch_end(self, epoch, logs={}):
        

        inps = next(self.gen)[0]
        output = self.model.predict(inps)
        summary=self.sess.run(self.summary_image, {self.placeholder: output})
        self.writer.add_summary(summary, epoch)
        self.writer.flush()

In [161]:
save_dir = 'hse_wgan_mnist/'
if not os.path.exists(save_dir):
    os.makedirs(save_dir)
    os.makedirs(save_dir + 'checkpoints')

image_callback = SaveImageSamplesCallback(train_gen_generator, save_dir + 'img')

critic_callbacks = [
    ModelCheckpoint(save_dir + 'checkpoints/critic-{epoch:02d}.h5', verbose=1, monitor='critic_loss'),
    TensorBoard(log_dir=save_dir + 'critic'),#, write_grads=True, histogram_freq=5),
    ReduceLROnPlateau(factor=0.1, patience=10, min_lr=0.00001, epsilon=0.01, verbose=1, monitor='critic_loss')
]

gen_callbacks = [
    ModelCheckpoint(save_dir + 'checkpoints/gen_{epoch:02d}.h5', monitor='generator_loss', verbose=1),
    TensorBoard(log_dir=save_dir + 'generator'),#, write_grads=True, histogram_freq=5),
    ReduceLROnPlateau(factor=0.1, patience=10, min_lr=0.00001, epsilon=0.01, verbose=1, monitor='generator_loss'),
    image_callback
]

In [162]:
fit_generator(gan_generator,
              critic, 
              gen_generator=train_gen_generator, 
              epochs= 256, 
              critic_generator=train_gen_critic, 
              steps_per_epoch=64, 
              gen_callbacks=gen_callbacks, 
              critic_callbacks=critic_callbacks)


Epoch 1/256
Epoch 1/256
 1/64 [..............................] - ETA: 19s - generator_loss: 11.6690 - generator_acc: 0.0000e+00 - critic_loss: -0.3492 - critic_wasserstain_loss_loss: -0.3509 - critic_grad_norm_loss: 1.7054e-04 - critic_wasserstain_loss_acc: 0.2016 - critic_grad_norm_acc: 1.0000
/home/duke/.conda/envs/heads/lib/python3.6/site-packages/keras/engine/training.py:973: UserWarning: Discrepancy between trainable weights and collected trainable weights, did you set `model.trainable` without calling `model.compile` after ?
  'Discrepancy between trainable weights and collected trainable'
63/64 [============================>.] - ETA: 0s - generator_loss: 11.1922 - generator_acc: 0.0000e+00 - critic_loss: -0.3709 - critic_wasserstain_loss_loss: -0.3827 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1753 - critic_grad_norm_acc: 1.0000Epoch 00001: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_01.h5
64/64 [==============================] - 14s 216ms/step - generator_loss: 11.1948 - generator_acc: 0.0000e+00 - critic_loss: -0.3579 - critic_wasserstain_loss_loss: -0.3699 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1760 - critic_grad_norm_acc: 1.0000
Epoch 00001: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-01.h5
64/64 [==============================] - 14s 217ms/step - generator_loss: 11.1948 - generator_acc: 0.0000e+00 - critic_loss: -0.3579 - critic_wasserstain_loss_loss: -0.3699 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1760 - critic_grad_norm_acc: 1.0000
Epoch 2/256
Epoch 2/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.1183 - generator_acc: 0.0000e+00 - critic_loss: -0.2636 - critic_wasserstain_loss_loss: -0.2736 - critic_grad_norm_loss: 9.9410e-04 - critic_wasserstain_loss_acc: 0.1840 - critic_grad_norm_acc: 1.0000Epoch 00002: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_02.h5
64/64 [==============================] - 14s 212ms/step - generator_loss: 11.1145 - generator_acc: 0.0000e+00 - critic_loss: -0.2630 - critic_wasserstain_loss_loss: -0.2729 - critic_grad_norm_loss: 9.8735e-04 - critic_wasserstain_loss_acc: 0.1840 - critic_grad_norm_acc: 1.0000
Epoch 00002: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-02.h5
64/64 [==============================] - 14s 213ms/step - generator_loss: 11.1145 - generator_acc: 0.0000e+00 - critic_loss: -0.2630 - critic_wasserstain_loss_loss: -0.2729 - critic_grad_norm_loss: 9.8735e-04 - critic_wasserstain_loss_acc: 0.1840 - critic_grad_norm_acc: 1.0000
Epoch 3/256
Epoch 3/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.9103 - generator_acc: 0.0000e+00 - critic_loss: -0.3112 - critic_wasserstain_loss_loss: -0.3208 - critic_grad_norm_loss: 9.5398e-04 - critic_wasserstain_loss_acc: 0.1776 - critic_grad_norm_acc: 1.0000Epoch 00003: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_03.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 10.9212 - generator_acc: 0.0000e+00 - critic_loss: -0.3125 - critic_wasserstain_loss_loss: -0.3223 - critic_grad_norm_loss: 9.7704e-04 - critic_wasserstain_loss_acc: 0.1771 - critic_grad_norm_acc: 1.0000
Epoch 00003: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-03.h5
64/64 [==============================] - 14s 216ms/step - generator_loss: 10.9212 - generator_acc: 0.0000e+00 - critic_loss: -0.3125 - critic_wasserstain_loss_loss: -0.3223 - critic_grad_norm_loss: 9.7704e-04 - critic_wasserstain_loss_acc: 0.1771 - critic_grad_norm_acc: 1.0000
Epoch 4/256
Epoch 4/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.2404 - generator_acc: 0.0000e+00 - critic_loss: -0.3275 - critic_wasserstain_loss_loss: -0.3390 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1734 - critic_grad_norm_acc: 0.9999Epoch 00004: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_04.h5
64/64 [==============================] - 14s 218ms/step - generator_loss: 11.2389 - generator_acc: 0.0000e+00 - critic_loss: -0.3288 - critic_wasserstain_loss_loss: -0.3403 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1732 - critic_grad_norm_acc: 0.9999
Epoch 00004: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-04.h5
64/64 [==============================] - 14s 218ms/step - generator_loss: 11.2389 - generator_acc: 0.0000e+00 - critic_loss: -0.3288 - critic_wasserstain_loss_loss: -0.3403 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1732 - critic_grad_norm_acc: 0.9999
Epoch 5/256
Epoch 5/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.8267 - generator_acc: 0.0000e+00 - critic_loss: -0.2778 - critic_wasserstain_loss_loss: -0.2922 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1739 - critic_grad_norm_acc: 1.0000Epoch 00005: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_05.h5
64/64 [==============================] - 14s 217ms/step - generator_loss: 10.8307 - generator_acc: 0.0000e+00 - critic_loss: -0.2778 - critic_wasserstain_loss_loss: -0.2921 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1740 - critic_grad_norm_acc: 1.0000
Epoch 00005: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-05.h5
64/64 [==============================] - 14s 218ms/step - generator_loss: 10.8307 - generator_acc: 0.0000e+00 - critic_loss: -0.2778 - critic_wasserstain_loss_loss: -0.2921 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1740 - critic_grad_norm_acc: 1.0000
Epoch 6/256
Epoch 6/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.1305 - generator_acc: 0.0000e+00 - critic_loss: -0.3062 - critic_wasserstain_loss_loss: -0.3163 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1745 - critic_grad_norm_acc: 1.0000Epoch 00006: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_06.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 11.1467 - generator_acc: 0.0000e+00 - critic_loss: -0.3052 - critic_wasserstain_loss_loss: -0.3152 - critic_grad_norm_loss: 9.9952e-04 - critic_wasserstain_loss_acc: 0.1753 - critic_grad_norm_acc: 1.0000
Epoch 00006: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-06.h5
64/64 [==============================] - 14s 216ms/step - generator_loss: 11.1467 - generator_acc: 0.0000e+00 - critic_loss: -0.3052 - critic_wasserstain_loss_loss: -0.3152 - critic_grad_norm_loss: 9.9952e-04 - critic_wasserstain_loss_acc: 0.1753 - critic_grad_norm_acc: 1.0000
Epoch 7/256
Epoch 7/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.7803 - generator_acc: 0.0000e+00 - critic_loss: -0.3121 - critic_wasserstain_loss_loss: -0.3293 - critic_grad_norm_loss: 0.0017 - critic_wasserstain_loss_acc: 0.1735 - critic_grad_norm_acc: 0.9999Epoch 00007: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_07.h5
64/64 [==============================] - 14s 221ms/step - generator_loss: 11.7913 - generator_acc: 0.0000e+00 - critic_loss: -0.3115 - critic_wasserstain_loss_loss: -0.3285 - critic_grad_norm_loss: 0.0017 - critic_wasserstain_loss_acc: 0.1744 - critic_grad_norm_acc: 0.9999
Epoch 00007: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-07.h5
64/64 [==============================] - 14s 221ms/step - generator_loss: 11.7913 - generator_acc: 0.0000e+00 - critic_loss: -0.3115 - critic_wasserstain_loss_loss: -0.3285 - critic_grad_norm_loss: 0.0017 - critic_wasserstain_loss_acc: 0.1744 - critic_grad_norm_acc: 0.9999
Epoch 8/256
Epoch 8/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.7136 - generator_acc: 0.0000e+00 - critic_loss: -0.2893 - critic_wasserstain_loss_loss: -0.3045 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1850 - critic_grad_norm_acc: 0.9999Epoch 00008: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_08.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 11.7178 - generator_acc: 0.0000e+00 - critic_loss: -0.2940 - critic_wasserstain_loss_loss: -0.3092 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1837 - critic_grad_norm_acc: 0.9999
Epoch 00008: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-08.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 11.7178 - generator_acc: 0.0000e+00 - critic_loss: -0.2940 - critic_wasserstain_loss_loss: -0.3092 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1837 - critic_grad_norm_acc: 0.9999
Epoch 9/256
Epoch 9/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.8265 - generator_acc: 0.0000e+00 - critic_loss: -0.2984 - critic_wasserstain_loss_loss: -0.3088 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1866 - critic_grad_norm_acc: 1.0000Epoch 00009: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_09.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 11.8169 - generator_acc: 0.0000e+00 - critic_loss: -0.2979 - critic_wasserstain_loss_loss: -0.3085 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1864 - critic_grad_norm_acc: 1.0000
Epoch 00009: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-09.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 11.8169 - generator_acc: 0.0000e+00 - critic_loss: -0.2979 - critic_wasserstain_loss_loss: -0.3085 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1864 - critic_grad_norm_acc: 1.0000
Epoch 10/256
Epoch 10/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.3659 - generator_acc: 0.0000e+00 - critic_loss: -0.3293 - critic_wasserstain_loss_loss: -0.3389 - critic_grad_norm_loss: 9.5545e-04 - critic_wasserstain_loss_acc: 0.1813 - critic_grad_norm_acc: 1.0000Epoch 00010: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_10.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 11.3692 - generator_acc: 0.0000e+00 - critic_loss: -0.3298 - critic_wasserstain_loss_loss: -0.3394 - critic_grad_norm_loss: 9.5581e-04 - critic_wasserstain_loss_acc: 0.1801 - critic_grad_norm_acc: 1.0000
Epoch 00010: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-10.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 11.3692 - generator_acc: 0.0000e+00 - critic_loss: -0.3298 - critic_wasserstain_loss_loss: -0.3394 - critic_grad_norm_loss: 9.5581e-04 - critic_wasserstain_loss_acc: 0.1801 - critic_grad_norm_acc: 1.0000
Epoch 11/256
Epoch 11/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.3633 - generator_acc: 0.0000e+00 - critic_loss: -0.2447 - critic_wasserstain_loss_loss: -0.2580 - critic_grad_norm_loss: 0.0013 - critic_wasserstain_loss_acc: 0.1843 - critic_grad_norm_acc: 1.0000Epoch 00011: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_11.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 11.3650 - generator_acc: 0.0000e+00 - critic_loss: -0.2449 - critic_wasserstain_loss_loss: -0.2581 - critic_grad_norm_loss: 0.0013 - critic_wasserstain_loss_acc: 0.1841 - critic_grad_norm_acc: 1.0000
Epoch 00011: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-11.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 11.3650 - generator_acc: 0.0000e+00 - critic_loss: -0.2449 - critic_wasserstain_loss_loss: -0.2581 - critic_grad_norm_loss: 0.0013 - critic_wasserstain_loss_acc: 0.1841 - critic_grad_norm_acc: 1.0000
Epoch 12/256
Epoch 12/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.8698 - generator_acc: 0.0000e+00 - critic_loss: -0.2954 - critic_wasserstain_loss_loss: -0.3042 - critic_grad_norm_loss: 8.8448e-04 - critic_wasserstain_loss_acc: 0.1778 - critic_grad_norm_acc: 1.0000Epoch 00012: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_12.h5
64/64 [==============================] - 14s 216ms/step - generator_loss: 11.8554 - generator_acc: 0.0000e+00 - critic_loss: -0.2956 - critic_wasserstain_loss_loss: -0.3047 - critic_grad_norm_loss: 9.0900e-04 - critic_wasserstain_loss_acc: 0.1780 - critic_grad_norm_acc: 1.0000
Epoch 00012: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-12.h5

Epoch 00012: reducing learning rate to 1e-05.
64/64 [==============================] - 14s 219ms/step - generator_loss: 11.8554 - generator_acc: 0.0000e+00 - critic_loss: -0.2956 - critic_wasserstain_loss_loss: -0.3047 - critic_grad_norm_loss: 9.0900e-04 - critic_wasserstain_loss_acc: 0.1780 - critic_grad_norm_acc: 1.0000
Epoch 13/256
Epoch 13/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.6502 - generator_acc: 0.0000e+00 - critic_loss: -0.0480 - critic_wasserstain_loss_loss: -0.0553 - critic_grad_norm_loss: 7.3587e-04 - critic_wasserstain_loss_acc: 0.2248 - critic_grad_norm_acc: 1.0000Epoch 00013: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_13.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 10.6549 - generator_acc: 0.0000e+00 - critic_loss: -0.0519 - critic_wasserstain_loss_loss: -0.0592 - critic_grad_norm_loss: 7.2560e-04 - critic_wasserstain_loss_acc: 0.2235 - critic_grad_norm_acc: 1.0000
Epoch 00013: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-13.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 10.6549 - generator_acc: 0.0000e+00 - critic_loss: -0.0519 - critic_wasserstain_loss_loss: -0.0592 - critic_grad_norm_loss: 7.2560e-04 - critic_wasserstain_loss_acc: 0.2235 - critic_grad_norm_acc: 1.0000
Epoch 14/256
Epoch 14/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.0104 - generator_acc: 0.0000e+00 - critic_loss: -0.2050 - critic_wasserstain_loss_loss: -0.2131 - critic_grad_norm_loss: 8.1602e-04 - critic_wasserstain_loss_acc: 0.1555 - critic_grad_norm_acc: 1.0000Epoch 00014: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_14.h5
64/64 [==============================] - 14s 212ms/step - generator_loss: 11.0061 - generator_acc: 0.0000e+00 - critic_loss: -0.2068 - critic_wasserstain_loss_loss: -0.2149 - critic_grad_norm_loss: 8.1670e-04 - critic_wasserstain_loss_acc: 0.1547 - critic_grad_norm_acc: 1.0000
Epoch 00014: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-14.h5
64/64 [==============================] - 14s 213ms/step - generator_loss: 11.0061 - generator_acc: 0.0000e+00 - critic_loss: -0.2068 - critic_wasserstain_loss_loss: -0.2149 - critic_grad_norm_loss: 8.1670e-04 - critic_wasserstain_loss_acc: 0.1547 - critic_grad_norm_acc: 1.0000
Epoch 15/256
Epoch 15/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.9471 - generator_acc: 0.0000e+00 - critic_loss: -0.2536 - critic_wasserstain_loss_loss: -0.2609 - critic_grad_norm_loss: 7.2994e-04 - critic_wasserstain_loss_acc: 0.1475 - critic_grad_norm_acc: 1.0000Epoch 00015: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_15.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 10.9494 - generator_acc: 0.0000e+00 - critic_loss: -0.2545 - critic_wasserstain_loss_loss: -0.2617 - critic_grad_norm_loss: 7.2313e-04 - critic_wasserstain_loss_acc: 0.1469 - critic_grad_norm_acc: 1.0000
Epoch 00015: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-15.h5
64/64 [==============================] - 14s 215ms/step - generator_loss: 10.9494 - generator_acc: 0.0000e+00 - critic_loss: -0.2545 - critic_wasserstain_loss_loss: -0.2617 - critic_grad_norm_loss: 7.2313e-04 - critic_wasserstain_loss_acc: 0.1469 - critic_grad_norm_acc: 1.0000
Epoch 16/256
Epoch 16/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.9961 - generator_acc: 0.0000e+00 - critic_loss: -0.2405 - critic_wasserstain_loss_loss: -0.2465 - critic_grad_norm_loss: 6.0448e-04 - critic_wasserstain_loss_acc: 0.1692 - critic_grad_norm_acc: 1.0000Epoch 00016: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_16.h5
64/64 [==============================] - 14s 221ms/step - generator_loss: 10.9954 - generator_acc: 0.0000e+00 - critic_loss: -0.2405 - critic_wasserstain_loss_loss: -0.2466 - critic_grad_norm_loss: 6.0682e-04 - critic_wasserstain_loss_acc: 0.1683 - critic_grad_norm_acc: 1.0000
Epoch 00016: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-16.h5
64/64 [==============================] - 14s 222ms/step - generator_loss: 10.9954 - generator_acc: 0.0000e+00 - critic_loss: -0.2405 - critic_wasserstain_loss_loss: -0.2466 - critic_grad_norm_loss: 6.0682e-04 - critic_wasserstain_loss_acc: 0.1683 - critic_grad_norm_acc: 1.0000
Epoch 17/256
Epoch 17/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.7774 - generator_acc: 0.0000e+00 - critic_loss: -0.1933 - critic_wasserstain_loss_loss: -0.2012 - critic_grad_norm_loss: 7.9093e-04 - critic_wasserstain_loss_acc: 0.1691 - critic_grad_norm_acc: 1.0000Epoch 00017: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_17.h5
64/64 [==============================] - 14s 213ms/step - generator_loss: 10.7783 - generator_acc: 0.0000e+00 - critic_loss: -0.1948 - critic_wasserstain_loss_loss: -0.2026 - critic_grad_norm_loss: 7.8190e-04 - critic_wasserstain_loss_acc: 0.1681 - critic_grad_norm_acc: 1.0000
Epoch 00017: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-17.h5
64/64 [==============================] - 14s 214ms/step - generator_loss: 10.7783 - generator_acc: 0.0000e+00 - critic_loss: -0.1948 - critic_wasserstain_loss_loss: -0.2026 - critic_grad_norm_loss: 7.8190e-04 - critic_wasserstain_loss_acc: 0.1681 - critic_grad_norm_acc: 1.0000
Epoch 18/256
Epoch 18/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.8927 - generator_acc: 0.0000e+00 - critic_loss: -0.2263 - critic_wasserstain_loss_loss: -0.2367 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1400 - critic_grad_norm_acc: 1.0000Epoch 00018: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_18.h5
64/64 [==============================] - 14s 216ms/step - generator_loss: 10.8960 - generator_acc: 0.0000e+00 - critic_loss: -0.2267 - critic_wasserstain_loss_loss: -0.2371 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1401 - critic_grad_norm_acc: 1.0000
Epoch 00018: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-18.h5
64/64 [==============================] - 14s 217ms/step - generator_loss: 10.8960 - generator_acc: 0.0000e+00 - critic_loss: -0.2267 - critic_wasserstain_loss_loss: -0.2371 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1401 - critic_grad_norm_acc: 1.0000
Epoch 19/256
Epoch 19/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.0972 - generator_acc: 0.0000e+00 - critic_loss: -0.2124 - critic_wasserstain_loss_loss: -0.2216 - critic_grad_norm_loss: 9.1962e-04 - critic_wasserstain_loss_acc: 0.1551 - critic_grad_norm_acc: 1.0000Epoch 00019: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_19.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 11.0925 - generator_acc: 0.0000e+00 - critic_loss: -0.2126 - critic_wasserstain_loss_loss: -0.2218 - critic_grad_norm_loss: 9.1347e-04 - critic_wasserstain_loss_acc: 0.1547 - critic_grad_norm_acc: 1.0000
Epoch 00019: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-19.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 11.0925 - generator_acc: 0.0000e+00 - critic_loss: -0.2126 - critic_wasserstain_loss_loss: -0.2218 - critic_grad_norm_loss: 9.1347e-04 - critic_wasserstain_loss_acc: 0.1547 - critic_grad_norm_acc: 1.0000
Epoch 20/256
Epoch 20/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.8973 - generator_acc: 0.0000e+00 - critic_loss: -0.2457 - critic_wasserstain_loss_loss: -0.2572 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1481 - critic_grad_norm_acc: 1.0000Epoch 00020: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_20.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 10.8969 - generator_acc: 0.0000e+00 - critic_loss: -0.2445 - critic_wasserstain_loss_loss: -0.2558 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1488 - critic_grad_norm_acc: 1.0000
Epoch 00020: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-20.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 10.8969 - generator_acc: 0.0000e+00 - critic_loss: -0.2445 - critic_wasserstain_loss_loss: -0.2558 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1488 - critic_grad_norm_acc: 1.0000
Epoch 21/256
Epoch 21/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.9785 - generator_acc: 0.0000e+00 - critic_loss: -0.2387 - critic_wasserstain_loss_loss: -0.2497 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1396 - critic_grad_norm_acc: 1.0000Epoch 00021: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_21.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 10.9810 - generator_acc: 0.0000e+00 - critic_loss: -0.2367 - critic_wasserstain_loss_loss: -0.2477 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1408 - critic_grad_norm_acc: 1.0000
Epoch 00021: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-21.h5
64/64 [==============================] - 14s 211ms/step - generator_loss: 10.9810 - generator_acc: 0.0000e+00 - critic_loss: -0.2367 - critic_wasserstain_loss_loss: -0.2477 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1408 - critic_grad_norm_acc: 1.0000
Epoch 22/256
Epoch 22/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.0017 - generator_acc: 0.0000e+00 - critic_loss: -0.2140 - critic_wasserstain_loss_loss: -0.2244 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1544 - critic_grad_norm_acc: 1.0000Epoch 00022: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_22.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 11.0004 - generator_acc: 0.0000e+00 - critic_loss: -0.2145 - critic_wasserstain_loss_loss: -0.2249 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1544 - critic_grad_norm_acc: 1.0000
Epoch 00022: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-22.h5
64/64 [==============================] - 14s 211ms/step - generator_loss: 11.0004 - generator_acc: 0.0000e+00 - critic_loss: -0.2145 - critic_wasserstain_loss_loss: -0.2249 - critic_grad_norm_loss: 0.0010 - critic_wasserstain_loss_acc: 0.1544 - critic_grad_norm_acc: 1.0000
Epoch 23/256
Epoch 23/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.7629 - generator_acc: 0.0000e+00 - critic_loss: -0.1137 - critic_wasserstain_loss_loss: -0.1204 - critic_grad_norm_loss: 6.7525e-04 - critic_wasserstain_loss_acc: 0.1910 - critic_grad_norm_acc: 1.0000Epoch 00023: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_23.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 10.7673 - generator_acc: 0.0000e+00 - critic_loss: -0.1154 - critic_wasserstain_loss_loss: -0.1221 - critic_grad_norm_loss: 6.7367e-04 - critic_wasserstain_loss_acc: 0.1896 - critic_grad_norm_acc: 1.0000
Epoch 00023: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-23.h5
64/64 [==============================] - 13s 210ms/step - generator_loss: 10.7673 - generator_acc: 0.0000e+00 - critic_loss: -0.1154 - critic_wasserstain_loss_loss: -0.1221 - critic_grad_norm_loss: 6.7367e-04 - critic_wasserstain_loss_acc: 0.1896 - critic_grad_norm_acc: 1.0000
Epoch 24/256
Epoch 24/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.8564 - generator_acc: 0.0000e+00 - critic_loss: -0.1729 - critic_wasserstain_loss_loss: -0.1800 - critic_grad_norm_loss: 7.1673e-04 - critic_wasserstain_loss_acc: 0.1667 - critic_grad_norm_acc: 1.0000Epoch 00024: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_24.h5

Epoch 00024: reducing learning rate to 1e-05.
64/64 [==============================] - 13s 210ms/step - generator_loss: 10.8527 - generator_acc: 0.0000e+00 - critic_loss: -0.1716 - critic_wasserstain_loss_loss: -0.1789 - critic_grad_norm_loss: 7.3340e-04 - critic_wasserstain_loss_acc: 0.1665 - critic_grad_norm_acc: 1.0000
Epoch 00024: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-24.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 10.8527 - generator_acc: 0.0000e+00 - critic_loss: -0.1716 - critic_wasserstain_loss_loss: -0.1789 - critic_grad_norm_loss: 7.3340e-04 - critic_wasserstain_loss_acc: 0.1665 - critic_grad_norm_acc: 1.0000
Epoch 25/256
Epoch 25/256
63/64 [============================>.] - ETA: 0s - generator_loss: 10.6714 - generator_acc: 0.0000e+00 - critic_loss: -0.3318 - critic_wasserstain_loss_loss: -0.3408 - critic_grad_norm_loss: 8.9937e-04 - critic_wasserstain_loss_acc: 0.1586 - critic_grad_norm_acc: 1.0000Epoch 00025: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_25.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 10.6775 - generator_acc: 0.0000e+00 - critic_loss: -0.3334 - critic_wasserstain_loss_loss: -0.3423 - critic_grad_norm_loss: 8.8766e-04 - critic_wasserstain_loss_acc: 0.1584 - critic_grad_norm_acc: 1.0000
Epoch 00025: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-25.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 10.6775 - generator_acc: 0.0000e+00 - critic_loss: -0.3334 - critic_wasserstain_loss_loss: -0.3423 - critic_grad_norm_loss: 8.8766e-04 - critic_wasserstain_loss_acc: 0.1584 - critic_grad_norm_acc: 1.0000
Epoch 26/256
Epoch 26/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.1960 - generator_acc: 0.0000e+00 - critic_loss: -0.4590 - critic_wasserstain_loss_loss: -0.4687 - critic_grad_norm_loss: 9.7766e-04 - critic_wasserstain_loss_acc: 0.1231 - critic_grad_norm_acc: 1.0000Epoch 00026: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_26.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.1943 - generator_acc: 0.0000e+00 - critic_loss: -0.4589 - critic_wasserstain_loss_loss: -0.4688 - critic_grad_norm_loss: 9.8231e-04 - critic_wasserstain_loss_acc: 0.1232 - critic_grad_norm_acc: 1.0000
Epoch 00026: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-26.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 11.1943 - generator_acc: 0.0000e+00 - critic_loss: -0.4589 - critic_wasserstain_loss_loss: -0.4688 - critic_grad_norm_loss: 9.8231e-04 - critic_wasserstain_loss_acc: 0.1232 - critic_grad_norm_acc: 1.0000
Epoch 27/256
Epoch 27/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.2865 - generator_acc: 0.0000e+00 - critic_loss: -0.5241 - critic_wasserstain_loss_loss: -0.5321 - critic_grad_norm_loss: 7.9862e-04 - critic_wasserstain_loss_acc: 0.1198 - critic_grad_norm_acc: 1.0000Epoch 00027: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_27.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.2903 - generator_acc: 0.0000e+00 - critic_loss: -0.5233 - critic_wasserstain_loss_loss: -0.5315 - critic_grad_norm_loss: 8.1838e-04 - critic_wasserstain_loss_acc: 0.1204 - critic_grad_norm_acc: 1.0000
Epoch 00027: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-27.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.2903 - generator_acc: 0.0000e+00 - critic_loss: -0.5233 - critic_wasserstain_loss_loss: -0.5315 - critic_grad_norm_loss: 8.1838e-04 - critic_wasserstain_loss_acc: 0.1204 - critic_grad_norm_acc: 1.0000
Epoch 28/256
Epoch 28/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.4184 - generator_acc: 0.0000e+00 - critic_loss: -0.5352 - critic_wasserstain_loss_loss: -0.5493 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1341 - critic_grad_norm_acc: 1.0000Epoch 00028: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_28.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.4237 - generator_acc: 0.0000e+00 - critic_loss: -0.5361 - critic_wasserstain_loss_loss: -0.5501 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1338 - critic_grad_norm_acc: 1.0000
Epoch 00028: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-28.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.4237 - generator_acc: 0.0000e+00 - critic_loss: -0.5361 - critic_wasserstain_loss_loss: -0.5501 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1338 - critic_grad_norm_acc: 1.0000
Epoch 29/256
Epoch 29/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.6177 - generator_acc: 0.0000e+00 - critic_loss: -0.5550 - critic_wasserstain_loss_loss: -0.5727 - critic_grad_norm_loss: 0.0018 - critic_wasserstain_loss_acc: 0.1298 - critic_grad_norm_acc: 1.0000Epoch 00029: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_29.h5
64/64 [==============================] - 14s 213ms/step - generator_loss: 11.6118 - generator_acc: 0.0000e+00 - critic_loss: -0.5534 - critic_wasserstain_loss_loss: -0.5710 - critic_grad_norm_loss: 0.0018 - critic_wasserstain_loss_acc: 0.1304 - critic_grad_norm_acc: 1.0000
Epoch 00029: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-29.h5
64/64 [==============================] - 14s 213ms/step - generator_loss: 11.6118 - generator_acc: 0.0000e+00 - critic_loss: -0.5534 - critic_wasserstain_loss_loss: -0.5710 - critic_grad_norm_loss: 0.0018 - critic_wasserstain_loss_acc: 0.1304 - critic_grad_norm_acc: 1.0000
Epoch 30/256
Epoch 30/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.5523 - generator_acc: 0.0000e+00 - critic_loss: -0.5237 - critic_wasserstain_loss_loss: -0.5324 - critic_grad_norm_loss: 8.7492e-04 - critic_wasserstain_loss_acc: 0.1186 - critic_grad_norm_acc: 1.0000Epoch 00030: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_30.h5
64/64 [==============================] - 13s 210ms/step - generator_loss: 11.5563 - generator_acc: 0.0000e+00 - critic_loss: -0.5240 - critic_wasserstain_loss_loss: -0.5329 - critic_grad_norm_loss: 8.8843e-04 - critic_wasserstain_loss_acc: 0.1187 - critic_grad_norm_acc: 1.0000
Epoch 00030: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-30.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 11.5563 - generator_acc: 0.0000e+00 - critic_loss: -0.5240 - critic_wasserstain_loss_loss: -0.5329 - critic_grad_norm_loss: 8.8843e-04 - critic_wasserstain_loss_acc: 0.1187 - critic_grad_norm_acc: 1.0000
Epoch 31/256
Epoch 31/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.6011 - generator_acc: 0.0000e+00 - critic_loss: -0.4771 - critic_wasserstain_loss_loss: -0.4968 - critic_grad_norm_loss: 0.0020 - critic_wasserstain_loss_acc: 0.1195 - critic_grad_norm_acc: 1.0000Epoch 00031: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_31.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.6027 - generator_acc: 0.0000e+00 - critic_loss: -0.4775 - critic_wasserstain_loss_loss: -0.4971 - critic_grad_norm_loss: 0.0020 - critic_wasserstain_loss_acc: 0.1194 - critic_grad_norm_acc: 1.0000
Epoch 00031: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-31.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.6027 - generator_acc: 0.0000e+00 - critic_loss: -0.4775 - critic_wasserstain_loss_loss: -0.4971 - critic_grad_norm_loss: 0.0020 - critic_wasserstain_loss_acc: 0.1194 - critic_grad_norm_acc: 1.0000
Epoch 32/256
Epoch 32/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.8198 - generator_acc: 0.0000e+00 - critic_loss: -0.4841 - critic_wasserstain_loss_loss: -0.4977 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1305 - critic_grad_norm_acc: 1.0000Epoch 00032: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_32.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.8190 - generator_acc: 0.0000e+00 - critic_loss: -0.4819 - critic_wasserstain_loss_loss: -0.4957 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1311 - critic_grad_norm_acc: 1.0000
Epoch 00032: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-32.h5
64/64 [==============================] - 13s 209ms/step - generator_loss: 11.8190 - generator_acc: 0.0000e+00 - critic_loss: -0.4819 - critic_wasserstain_loss_loss: -0.4957 - critic_grad_norm_loss: 0.0014 - critic_wasserstain_loss_acc: 0.1311 - critic_grad_norm_acc: 1.0000
Epoch 33/256
Epoch 33/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.8747 - generator_acc: 0.0000e+00 - critic_loss: -0.4644 - critic_wasserstain_loss_loss: -0.4799 - critic_grad_norm_loss: 0.0016 - critic_wasserstain_loss_acc: 0.1336 - critic_grad_norm_acc: 1.0000Epoch 00033: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_33.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.8751 - generator_acc: 0.0000e+00 - critic_loss: -0.4652 - critic_wasserstain_loss_loss: -0.4806 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1324 - critic_grad_norm_acc: 1.0000
Epoch 00033: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-33.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.8751 - generator_acc: 0.0000e+00 - critic_loss: -0.4652 - critic_wasserstain_loss_loss: -0.4806 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1324 - critic_grad_norm_acc: 1.0000
Epoch 34/256
Epoch 34/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.9810 - generator_acc: 0.0000e+00 - critic_loss: -0.4513 - critic_wasserstain_loss_loss: -0.4635 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1068 - critic_grad_norm_acc: 1.0000Epoch 00034: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_34.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.9799 - generator_acc: 0.0000e+00 - critic_loss: -0.4504 - critic_wasserstain_loss_loss: -0.4627 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1075 - critic_grad_norm_acc: 1.0000
Epoch 00034: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-34.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 11.9799 - generator_acc: 0.0000e+00 - critic_loss: -0.4504 - critic_wasserstain_loss_loss: -0.4627 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1075 - critic_grad_norm_acc: 1.0000
Epoch 35/256
Epoch 35/256
63/64 [============================>.] - ETA: 0s - generator_loss: 12.0163 - generator_acc: 0.0000e+00 - critic_loss: -0.4334 - critic_wasserstain_loss_loss: -0.4448 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1266 - critic_grad_norm_acc: 1.0000Epoch 00035: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_35.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 12.0164 - generator_acc: 0.0000e+00 - critic_loss: -0.4335 - critic_wasserstain_loss_loss: -0.4450 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1271 - critic_grad_norm_acc: 1.0000
Epoch 00035: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-35.h5
64/64 [==============================] - 13s 208ms/step - generator_loss: 12.0164 - generator_acc: 0.0000e+00 - critic_loss: -0.4335 - critic_wasserstain_loss_loss: -0.4450 - critic_grad_norm_loss: 0.0012 - critic_wasserstain_loss_acc: 0.1271 - critic_grad_norm_acc: 1.0000
Epoch 36/256
Epoch 36/256
63/64 [============================>.] - ETA: 0s - generator_loss: 12.2368 - generator_acc: 0.0000e+00 - critic_loss: -0.4362 - critic_wasserstain_loss_loss: -0.4471 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1213 - critic_grad_norm_acc: 1.0000Epoch 00036: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_36.h5
64/64 [==============================] - 14s 212ms/step - generator_loss: 12.2363 - generator_acc: 0.0000e+00 - critic_loss: -0.4351 - critic_wasserstain_loss_loss: -0.4460 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1224 - critic_grad_norm_acc: 1.0000
Epoch 00036: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-36.h5
64/64 [==============================] - 14s 212ms/step - generator_loss: 12.2363 - generator_acc: 0.0000e+00 - critic_loss: -0.4351 - critic_wasserstain_loss_loss: -0.4460 - critic_grad_norm_loss: 0.0011 - critic_wasserstain_loss_acc: 0.1224 - critic_grad_norm_acc: 1.0000
Epoch 37/256
Epoch 37/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.8802 - generator_acc: 0.0000e+00 - critic_loss: -0.4573 - critic_wasserstain_loss_loss: -0.4726 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1200 - critic_grad_norm_acc: 1.0000Epoch 00037: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_37.h5
64/64 [==============================] - 13s 210ms/step - generator_loss: 11.8847 - generator_acc: 0.0000e+00 - critic_loss: -0.4586 - critic_wasserstain_loss_loss: -0.4737 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1199 - critic_grad_norm_acc: 1.0000
Epoch 00037: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-37.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 11.8847 - generator_acc: 0.0000e+00 - critic_loss: -0.4586 - critic_wasserstain_loss_loss: -0.4737 - critic_grad_norm_loss: 0.0015 - critic_wasserstain_loss_acc: 0.1199 - critic_grad_norm_acc: 1.0000
Epoch 38/256
Epoch 38/256
63/64 [============================>.] - ETA: 0s - generator_loss: 11.7607 - generator_acc: 0.0000e+00 - critic_loss: -0.4732 - critic_wasserstain_loss_loss: -0.4966 - critic_grad_norm_loss: 0.0023 - critic_wasserstain_loss_acc: 0.1336 - critic_grad_norm_acc: 1.0000Epoch 00038: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/gen_38.h5
64/64 [==============================] - 13s 211ms/step - generator_loss: 11.7526 - generator_acc: 0.0000e+00 - critic_loss: -0.4744 - critic_wasserstain_loss_loss: -0.4979 - critic_grad_norm_loss: 0.0024 - critic_wasserstain_loss_acc: 0.1337 - critic_grad_norm_acc: 1.0000
Epoch 00038: saving model to /home/duke/Documents/artefacts/hse_wgan_mnist/checkpoints/critic-38.h5
64/64 [==============================] - 14s 211ms/step - generator_loss: 11.7526 - generator_acc: 0.0000e+00 - critic_loss: -0.4744 - critic_wasserstain_loss_loss: -0.4979 - critic_grad_norm_loss: 0.0024 - critic_wasserstain_loss_acc: 0.1337 - critic_grad_norm_acc: 1.0000
Epoch 39/256
Epoch 39/256
 4/64 [>.............................] - ETA: 13s - generator_loss: 11.2738 - generator_acc: 0.0000e+00 - critic_loss: -0.5265 - critic_wasserstain_loss_loss: -0.5435 - critic_grad_norm_loss: 0.0017 - critic_wasserstain_loss_acc: 0.1250 - critic_grad_norm_acc: 1.0000
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-162-f1332a41fbf9> in <module>()
      6               steps_per_epoch=64,
      7               gen_callbacks=gen_callbacks,
----> 8               critic_callbacks=critic_callbacks)

<ipython-input-156-39f952b944af> in fit_generator(gan_generator, gan_critic, gen_generator, critic_generator, steps_per_epoch, n_gen, epochs, verbose, gen_callbacks, critic_callbacks, initial_epoch)
     83                 _, x_gen, y_gen = validate_output(gen_generator_output)
     84 
---> 85                 gen_outs = gan_generator.train_on_batch(x_gen, y_gen)
     86 
     87             outs = gen_outs + critic_outs

~/.conda/envs/heads/lib/python3.6/site-packages/keras/engine/training.py in train_on_batch(self, x, y, sample_weight, class_weight)
   1837             ins = x + y + sample_weights
   1838         self._make_train_function()
-> 1839         outputs = self.train_function(ins)
   1840         if len(outputs) == 1:
   1841             return outputs[0]

~/.conda/envs/heads/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in __call__(self, inputs)
   2355         session = get_session()
   2356         updated = session.run(fetches=fetches, feed_dict=feed_dict,
-> 2357                               **self.session_kwargs)
   2358         return updated[:len(self.outputs)]
   2359 

~/.conda/envs/heads/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    887     try:
    888       result = self._run(None, fetches, feed_dict, options_ptr,
--> 889                          run_metadata_ptr)
    890       if run_metadata:
    891         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

~/.conda/envs/heads/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1118     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1119       results = self._do_run(handle, final_targets, final_fetches,
-> 1120                              feed_dict_tensor, options, run_metadata)
   1121     else:
   1122       results = []

~/.conda/envs/heads/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1315     if handle is None:
   1316       return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1317                            options, run_metadata)
   1318     else:
   1319       return self._do_call(_prun_fn, self._session, handle, feeds, fetches)

~/.conda/envs/heads/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1321   def _do_call(self, fn, *args):
   1322     try:
-> 1323       return fn(*args)
   1324     except errors.OpError as e:
   1325       message = compat.as_text(e.message)

~/.conda/envs/heads/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
   1300           return tf_session.TF_Run(session, options,
   1301                                    feed_dict, fetch_list, target_list,
-> 1302                                    status, run_metadata)
   1303 
   1304     def _prun_fn(session, handle, feed_dict, fetch_list):

KeyboardInterrupt: 

In [ ]: