Anna KaRNNa

In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.

This network is based off of Andrej Karpathy's post on RNNs and implementation in Torch. Also, some information here at r2rt and from Sherjil Ozair on GitHub. Below is the general architecture of the character-wise RNN.


In [1]:
import time
from collections import namedtuple

import numpy as np
import tensorflow as tf

First we'll load the text file and convert it into integers for our network to use. Here I'm creating a couple dictionaries to convert the characters to and from integers. Encoding the characters as integers makes it easier to use as input in the network.


In [2]:
with open('anna.txt', 'r') as f:
    text=f.read()
vocab = sorted(set(text))
vocab_to_int = {c: i for i, c in enumerate(vocab)}
int_to_vocab = dict(enumerate(vocab))
encoded = np.array([vocab_to_int[c] for c in text], dtype=np.int32)

Let's check out the first 100 characters, make sure everything is peachy. According to the American Book Review, this is the 6th best first line of a book ever.


In [3]:
text[:100]


Out[3]:
'Chapter 1\n\n\nHappy families are all alike; every unhappy family is unhappy in its own\nway.\n\nEverythin'

And we can see the characters encoded as integers.


In [4]:
encoded[:100]


Out[4]:
array([31, 64, 57, 72, 76, 61, 74,  1, 16,  0,  0,  0, 36, 57, 72, 72, 81,
        1, 62, 57, 69, 65, 68, 65, 61, 75,  1, 57, 74, 61,  1, 57, 68, 68,
        1, 57, 68, 65, 67, 61, 26,  1, 61, 78, 61, 74, 81,  1, 77, 70, 64,
       57, 72, 72, 81,  1, 62, 57, 69, 65, 68, 81,  1, 65, 75,  1, 77, 70,
       64, 57, 72, 72, 81,  1, 65, 70,  1, 65, 76, 75,  1, 71, 79, 70,  0,
       79, 57, 81, 13,  0,  0, 33, 78, 61, 74, 81, 76, 64, 65, 70], dtype=int32)

Since the network is working with individual characters, it's similar to a classification problem in which we are trying to predict the next character from the previous text. Here's how many 'classes' our network has to pick from.


In [5]:
len(vocab)


Out[5]:
83

Making training mini-batches

Here is where we'll make our mini-batches for training. Remember that we want our batches to be multiple sequences of some desired number of sequence steps. Considering a simple example, our batches would look like this:


We have our text encoded as integers as one long array in encoded. Let's create a function that will give us an iterator for our batches. I like using generator functions to do this. Then we can pass encoded into this function and get our batch generator.

The first thing we need to do is discard some of the text so we only have completely full batches. Each batch contains $N \times M$ characters, where $N$ is the batch size (the number of sequences) and $M$ is the number of steps. Then, to get the number of batches we can make from some array arr, you divide the length of arr by the batch size. Once you know the number of batches and the batch size, you can get the total number of characters to keep.

After that, we need to split arr into $N$ sequences. You can do this using arr.reshape(size) where size is a tuple containing the dimensions sizes of the reshaped array. We know we want $N$ sequences (n_seqs below), let's make that the size of the first dimension. For the second dimension, you can use -1 as a placeholder in the size, it'll fill up the array with the appropriate data for you. After this, you should have an array that is $N \times (M * K)$ where $K$ is the number of batches.

Now that we have this array, we can iterate through it to get our batches. The idea is each batch is a $N \times M$ window on the array. For each subsequent batch, the window moves over by n_steps. We also want to create both the input and target arrays. Remember that the targets are the inputs shifted over one character. You'll usually see the first input character used as the last target character, so something like this:

y[:, :-1], y[:, -1] = x[:, 1:], x[:, 0]

where x is the input batch and y is the target batch.

The way I like to do this window is use range to take steps of size n_steps from $0$ to arr.shape[1], the total number of steps in each sequence. That way, the integers you get from range always point to the start of a batch, and each window is n_steps wide.

Exercise: Write the code for creating batches in the function below. The exercises in this notebook will not be easy. I've provided a notebook with solutions alongside this notebook. If you get stuck, checkout the solutions. The most important thing is that you don't copy and paste the code into here, type out the solution code yourself.


In [6]:
def get_batches(arr, n_seqs, n_steps):
    '''Create a generator that returns batches of size
       n_seqs x n_steps from arr.
       
       Arguments
       ---------
       arr: Array you want to make batches from
       n_seqs: Batch size, the number of sequences per batch
       n_steps: Number of sequence steps per batch
    '''
    # Get the number of characters per batch and number of batches we can make
    characters_per_batch = n_seqs * n_steps
    n_batches = len(arr) // characters_per_batch
    
    # Keep only enough characters to make full batches
    arr = arr[:n_batches * characters_per_batch]
    
    # Reshape into n_seqs rows
    arr = arr.reshape((n_seqs, -1))
    
    for n in range(0, arr.shape[1], n_steps):
        # The features
        x = arr[:, n : n + n_steps]
        # The targets, shifted by one
        y = np.zeros_like(x)
        y[:, :-1], y[:, -1] = x[:, 1:], x[:, 0]
        yield x, y

Now I'll make my data sets and we can check out what's going on here. Here I'm going to use a batch size of 10 and 50 sequence steps.


In [7]:
batches = get_batches(encoded, 10, 50)
x, y = next(batches)

In [8]:
print('x\n', x[:10, :10])
print('\ny\n', y[:10, :10])


x
 [[31 64 57 72 76 61 74  1 16  0]
 [ 1 57 69  1 70 71 76  1 63 71]
 [78 65 70 13  0  0  3 53 61 75]
 [70  1 60 77 74 65 70 63  1 64]
 [ 1 65 76  1 65 75 11  1 75 65]
 [ 1 37 76  1 79 57 75  0 71 70]
 [64 61 70  1 59 71 69 61  1 62]
 [26  1 58 77 76  1 70 71 79  1]
 [76  1 65 75 70  7 76 13  1 48]
 [ 1 75 57 65 60  1 76 71  1 64]]

y
 [[64 57 72 76 61 74  1 16  0  0]
 [57 69  1 70 71 76  1 63 71 65]
 [65 70 13  0  0  3 53 61 75 11]
 [ 1 60 77 74 65 70 63  1 64 65]
 [65 76  1 65 75 11  1 75 65 74]
 [37 76  1 79 57 75  0 71 70 68]
 [61 70  1 59 71 69 61  1 62 71]
 [ 1 58 77 76  1 70 71 79  1 75]
 [ 1 65 75 70  7 76 13  1 48 64]
 [75 57 65 60  1 76 71  1 64 61]]

If you implemented get_batches correctly, the above output should look something like

x
 [[55 63 69 22  6 76 45  5 16 35]
 [ 5 69  1  5 12 52  6  5 56 52]
 [48 29 12 61 35 35  8 64 76 78]
 [12  5 24 39 45 29 12 56  5 63]
 [ 5 29  6  5 29 78 28  5 78 29]
 [ 5 13  6  5 36 69 78 35 52 12]
 [63 76 12  5 18 52  1 76  5 58]
 [34  5 73 39  6  5 12 52 36  5]
 [ 6  5 29 78 12 79  6 61  5 59]
 [ 5 78 69 29 24  5  6 52  5 63]]

y
 [[63 69 22  6 76 45  5 16 35 35]
 [69  1  5 12 52  6  5 56 52 29]
 [29 12 61 35 35  8 64 76 78 28]
 [ 5 24 39 45 29 12 56  5 63 29]
 [29  6  5 29 78 28  5 78 29 45]
 [13  6  5 36 69 78 35 52 12 43]
 [76 12  5 18 52  1 76  5 58 52]
 [ 5 73 39  6  5 12 52 36  5 78]
 [ 5 29 78 12 79  6 61  5 59 63]
 [78 69 29 24  5  6 52  5 63 76]]

although the exact numbers will be different. Check to make sure the data is shifted over one step for y.

Building the model

Below is where you'll build the network. We'll break it up into parts so it's easier to reason about each bit. Then we can connect them up into the whole network.

Inputs

First off we'll create our input placeholders. As usual we need placeholders for the training data and the targets. We'll also create a placeholder for dropout layers called keep_prob. This will be a scalar, that is a 0-D tensor. To make a scalar, you create a placeholder without giving it a size.

Exercise: Create the input placeholders in the function below.


In [28]:
def build_inputs(batch_size, num_steps):
    ''' Define placeholders for inputs, targets, and dropout 
    
        Arguments
        ---------
        batch_size: Batch size, number of sequences per batch
        num_steps: Number of sequence steps in a batch
        
    '''
    # Declare placeholders we'll feed into the graph
    inputs = tf.placeholder(tf.int32, (batch_size, num_steps), name='inputs')
    targets = tf.placeholder(tf.int32, (batch_size, num_steps), name='targets')
    
    # Keep probability placeholder for drop out layers
    keep_prob = tf.placeholder(tf.float32, name='keep_prob')
    
    return inputs, targets, keep_prob

LSTM Cell

Here we will create the LSTM cell we'll use in the hidden layer. We'll use this cell as a building block for the RNN. So we aren't actually defining the RNN here, just the type of cell we'll use in the hidden layer.

We first create a basic LSTM cell with

lstm = tf.contrib.rnn.BasicLSTMCell(num_units)

where num_units is the number of units in the hidden layers in the cell. Then we can add dropout by wrapping it with

tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)

You pass in a cell and it will automatically add dropout to the inputs or outputs. Finally, we can stack up the LSTM cells into layers with tf.contrib.rnn.MultiRNNCell. With this, you pass in a list of cells and it will send the output of one cell into the next cell. Previously with TensorFlow 1.0, you could do this

tf.contrib.rnn.MultiRNNCell([cell]*num_layers)

This might look a little weird if you know Python well because this will create a list of the same cell object. However, TensorFlow 1.0 will create different weight matrices for all cell objects. But, starting with TensorFlow 1.1 you actually need to create new cell objects in the list. To get it to work in TensorFlow 1.1, it should look like

def build_cell(num_units, keep_prob):
    lstm = tf.contrib.rnn.BasicLSTMCell(num_units)
    drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)

    return drop

tf.contrib.rnn.MultiRNNCell([build_cell(num_units, keep_prob) for _ in range(num_layers)])

Even though this is actually multiple LSTM cells stacked on each other, you can treat the multiple layers as one cell.

We also need to create an initial cell state of all zeros. This can be done like so

initial_state = cell.zero_state(batch_size, tf.float32)

Below, we implement the build_lstm function to create these LSTM cells and the initial state.


In [23]:
def build_lstm(lstm_size, num_layers, batch_size, keep_prob):
    ''' Build LSTM cell.
    
        Arguments
        ---------
        keep_prob: Scalar tensor (tf.placeholder) for the dropout keep probability
        lstm_size: Size of the hidden layers in the LSTM cells
        num_layers: Number of LSTM layers
        batch_size: Batch size

    '''
    ### Build the LSTM Cell
    # Use a basic LSTM cell
    def build_lstm_cell(lstm_size, keep_prob):  
        lstm = tf.contrib.rnn.BasicLSTMCell(lstm_size)
    
        # Add dropout to the cell outputs
        drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)
        return drop
    
    # Stack up multiple LSTM layers, for deep learning
    cell = tf.contrib.rnn.MultiRNNCell([build_lstm_cell(lstm_size, keep_prob) for _ in range(num_layers)])
    initial_state = cell.zero_state(batch_size, tf.float32)
    
    return cell, initial_state

RNN Output

Here we'll create the output layer. We need to connect the output of the RNN cells to a full connected layer with a softmax output. The softmax output gives us a probability distribution we can use to predict the next character, so we want this layer to have size $C$, the number of classes/characters we have in our text.

If our input has batch size $N$, number of steps $M$, and the hidden layer has $L$ hidden units, then the output is a 3D tensor with size $N \times M \times L$. The output of each LSTM cell has size $L$, we have $M$ of them, one for each sequence step, and we have $N$ sequences. So the total size is $N \times M \times L$.

We are using the same fully connected layer, the same weights, for each of the outputs. Then, to make things easier, we should reshape the outputs into a 2D tensor with shape $(M * N) \times L$. That is, one row for each sequence and step, where the values of each row are the output from the LSTM cells. We get the LSTM output as a list, lstm_output. First we need to concatenate this whole list into one array with tf.concat. Then, reshape it (with tf.reshape) to size $(M * N) \times L$.

One we have the outputs reshaped, we can do the matrix multiplication with the weights. We need to wrap the weight and bias variables in a variable scope with tf.variable_scope(scope_name) because there are weights being created in the LSTM cells. TensorFlow will throw an error if the weights created here have the same names as the weights created in the LSTM cells, which they will be default. To avoid this, we wrap the variables in a variable scope so we can give them unique names.

Exercise: Implement the output layer in the function below.


In [17]:
def build_output(lstm_output, in_size, out_size):
    ''' Build a softmax layer, return the softmax output and logits.
    
        Arguments
        ---------
        
        lstm_output: List of output tensors from the LSTM layer
        in_size: Size of the input tensor, for example, size of the LSTM cells
        out_size: Size of this softmax layer
    
    '''

    # Reshape output so it's a bunch of rows, one row for each step for each sequence.
    # Concatenate lstm_output over axis 1 (the columns)
    seq_output = tf.concat(lstm_output, axis=1)
    # Reshape seq_output to a 2D tensor with lstm_size columns
    x = tf.reshape(seq_output, (-1, in_size))
    
    # Connect the RNN outputs to a softmax layer
    with tf.variable_scope('softmax'):
        # Create the weight and bias variables here
        softmax_w = tf.Variable(tf.truncated_normal((in_size, out_size), stddev=0.1))
        softmax_b = tf.Variable(tf.zeros(out_size))
    
    # Since output is a bunch of rows of RNN cell outputs, logits will be a bunch
    # of rows of logit outputs, one for each step and sequence
    logits = tf.matmul(x, softmax_w) + softmax_b
    
    # Use softmax to get the probabilities for predicted characters
    out = tf.nn.softmax(logits, name='predictions')
    
    return out, logits

Training loss

Next up is the training loss. We get the logits and targets and calculate the softmax cross-entropy loss. First we need to one-hot encode the targets, we're getting them as encoded characters. Then, reshape the one-hot targets so it's a 2D tensor with size $(M*N) \times C$ where $C$ is the number of classes/characters we have. Remember that we reshaped the LSTM outputs and ran them through a fully connected layer with $C$ units. So our logits will also have size $(M*N) \times C$.

Then we run the logits and targets through tf.nn.softmax_cross_entropy_with_logits and find the mean to get the loss.

Exercise: Implement the loss calculation in the function below.


In [12]:
def build_loss(logits, targets, lstm_size, num_classes):
    ''' Calculate the loss from the logits and the targets.
    
        Arguments
        ---------
        logits: Logits from final fully connected layer
        targets: Targets for supervised learning
        lstm_size: Number of LSTM hidden units
        num_classes: Number of classes in targets
        
    '''
    
    # One-hot encode targets and reshape to match logits, one row per sequence per step
    y_one_hot = tf.one_hot(targets, num_classes)
    y_reshaped = tf.reshape(y_one_hot, logits.shape)
    
    # Softmax cross entropy loss
    loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=y_reshaped))
    
    return loss

Optimizer

Here we build the optimizer. Normal RNNs have have issues gradients exploding and disappearing. LSTMs fix the disappearance problem, but the gradients can still grow without bound. To fix this, we can clip the gradients above some threshold. That is, if a gradient is larger than that threshold, we set it to the threshold. This will ensure the gradients never grow overly large. Then we use an AdamOptimizer for the learning step.


In [13]:
def build_optimizer(loss, learning_rate, grad_clip):
    ''' Build optmizer for training, using gradient clipping.
    
        Arguments:
        loss: Network loss
        learning_rate: Learning rate for optimizer
    
    '''
    
    # Optimizer for training, using gradient clipping to control exploding gradients
    tvars = tf.trainable_variables()
    grads, _ = tf.clip_by_global_norm(tf.gradients(loss, tvars), grad_clip)
    train_op = tf.train.AdamOptimizer(learning_rate)
    optimizer = train_op.apply_gradients(zip(grads, tvars))
    
    return optimizer

Build the network

Now we can put all the pieces together and build a class for the network. To actually run data through the LSTM cells, we will use tf.nn.dynamic_rnn. This function will pass the hidden and cell states across LSTM cells appropriately for us. It returns the outputs for each LSTM cell at each step for each sequence in the mini-batch. It also gives us the final LSTM state. We want to save this state as final_state so we can pass it to the first LSTM cell in the the next mini-batch run. For tf.nn.dynamic_rnn, we pass in the cell and initial state we get from build_lstm, as well as our input sequences. Also, we need to one-hot encode the inputs before going into the RNN.

Exercise: Use the functions you've implemented previously and tf.nn.dynamic_rnn to build the network.


In [25]:
class CharRNN:
    
    def __init__(self, num_classes, batch_size=64, num_steps=50, 
                       lstm_size=128, num_layers=2, learning_rate=0.001, 
                       grad_clip=5, sampling=False):
    
        # When we're using this network for sampling later, we'll be passing in
        # one character at a time, so providing an option for that
        if sampling == True:
            batch_size, num_steps = 1, 1
        else:
            batch_size, num_steps = batch_size, num_steps

        tf.reset_default_graph()
        
        # Build the input placeholder tensors
        self.inputs, self.targets, self.keep_prob = build_inputs(batch_size, num_steps)

        # Build the LSTM cell
        cell, self.initial_state = build_lstm(lstm_size, num_layers, batch_size, self.keep_prob)

        ### Run the data through the RNN layers
        # First, one-hot encode the input tokens
        x_one_hot = tf.one_hot(self.inputs, num_classes)
        
        # Run each sequence step through the RNN with tf.nn.dynamic_rnn 
        outputs, state = tf.nn.dynamic_rnn(cell, x_one_hot, initial_state=self.initial_state)
        self.final_state = state
        
        # Get softmax predictions and logits
        self.prediction, self.logits = build_output(outputs, lstm_size, num_classes)
        
        # Loss and optimizer (with gradient clipping)
        self.loss =  build_loss(self.logits, self.targets, lstm_size, num_classes)
        self.optimizer = build_optimizer(self.loss, learning_rate, grad_clip)

Hyperparameters

Here are the hyperparameters for the network.

  • batch_size - Number of sequences running through the network in one pass.
  • num_steps - Number of characters in the sequence the network is trained on. Larger is better typically, the network will learn more long range dependencies. But it takes longer to train. 100 is typically a good number here.
  • lstm_size - The number of units in the hidden layers.
  • num_layers - Number of hidden LSTM layers to use
  • learning_rate - Learning rate for training
  • keep_prob - The dropout keep probability when training. If you're network is overfitting, try decreasing this.

Here's some good advice from Andrej Karpathy on training the network. I'm going to copy it in here for your benefit, but also link to where it originally came from.

Tips and Tricks

Monitoring Validation Loss vs. Training Loss

If you're somewhat new to Machine Learning or Neural Networks it can take a bit of expertise to get good models. The most important quantity to keep track of is the difference between your training loss (printed during training) and the validation loss (printed once in a while when the RNN is run on the validation data (by default every 1000 iterations)). In particular:

  • If your training loss is much lower than validation loss then this means the network might be overfitting. Solutions to this are to decrease your network size, or to increase dropout. For example you could try dropout of 0.5 and so on.
  • If your training/validation loss are about equal then your model is underfitting. Increase the size of your model (either number of layers or the raw number of neurons per layer)

Approximate number of parameters

The two most important parameters that control the model are lstm_size and num_layers. I would advise that you always use num_layers of either 2/3. The lstm_size can be adjusted based on how much data you have. The two important quantities to keep track of here are:

  • The number of parameters in your model. This is printed when you start training.
  • The size of your dataset. 1MB file is approximately 1 million characters.

These two should be about the same order of magnitude. It's a little tricky to tell. Here are some examples:

  • I have a 100MB dataset and I'm using the default parameter settings (which currently print 150K parameters). My data size is significantly larger (100 mil >> 0.15 mil), so I expect to heavily underfit. I am thinking I can comfortably afford to make lstm_size larger.
  • I have a 10MB dataset and running a 10 million parameter model. I'm slightly nervous and I'm carefully monitoring my validation loss. If it's larger than my training loss then I may want to try to increase dropout a bit and see if that helps the validation loss.

Best models strategy

The winning strategy to obtaining very good models (if you have the compute time) is to always err on making the network larger (as large as you're willing to wait for it to compute) and then try different dropout values (between 0,1). Whatever model has the best validation performance (the loss, written in the checkpoint filename, low is good) is the one you should use in the end.

It is very common in deep learning to run many different models with many different hyperparameter settings, and in the end take whatever checkpoint gave the best validation performance.

By the way, the size of your training and validation splits are also parameters. Make sure you have a decent amount of data in your validation set or otherwise the validation performance will be noisy and not very informative.


In [57]:
batch_size = 300         # Sequences per batch
num_steps = 200          # Number of sequence steps per batch
lstm_size = 500         # Size of hidden layers in LSTMs
num_layers = 2          # Number of LSTM layers
learning_rate = 0.001    # Learning rate
keep_prob = 0.5         # Dropout keep probability

Time for training

This is typical training code, passing inputs and targets into the network, then running the optimizer. Here we also get back the final LSTM state for the mini-batch. Then, we pass that state back into the network so the next batch can continue the state from the previous batch. And every so often (set by save_every_n) I save a checkpoint.

Here I'm saving checkpoints with the format

i{iteration number}_l{# hidden layer units}.ckpt

Exercise: Set the hyperparameters above to train the network. Watch the training loss, it should be consistently dropping. Also, I highly advise running this on a GPU.


In [58]:
epochs = 20
# Save every N iterations
save_every_n = 200

model = CharRNN(len(vocab), batch_size=batch_size, num_steps=num_steps,
                lstm_size=lstm_size, num_layers=num_layers, 
                learning_rate=learning_rate)

saver = tf.train.Saver(max_to_keep=100)
with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    
    # Use the line below to load a checkpoint and resume training
    #saver.restore(sess, 'checkpoints/______.ckpt')
    counter = 0
    for e in range(epochs):
        # Train network
        new_state = sess.run(model.initial_state)
        loss = 0
        for x, y in get_batches(encoded, batch_size, num_steps):
            counter += 1
            start = time.time()
            feed = {model.inputs: x,
                    model.targets: y,
                    model.keep_prob: keep_prob,
                    model.initial_state: new_state}
            batch_loss, new_state, _ = sess.run([model.loss, 
                                                 model.final_state, 
                                                 model.optimizer], 
                                                 feed_dict=feed)
            
            end = time.time()
            print('Epoch: {}/{}... '.format(e+1, epochs),
                  'Training Step: {}... '.format(counter),
                  'Training loss: {:.4f}... '.format(batch_loss),
                  '{:.4f} sec/batch'.format((end-start)))
        
            if (counter % save_every_n == 0):
                saver.save(sess, "checkpoints/i{}_l{}.ckpt".format(counter, lstm_size))
    
    saver.save(sess, "checkpoints/i{}_l{}.ckpt".format(counter, lstm_size))


Epoch: 1/20...  Training Step: 1...  Training loss: 4.4205...  0.3868 sec/batch
Epoch: 1/20...  Training Step: 2...  Training loss: 4.3354...  0.3526 sec/batch
Epoch: 1/20...  Training Step: 3...  Training loss: 3.8648...  0.3530 sec/batch
Epoch: 1/20...  Training Step: 4...  Training loss: 5.1529...  0.3551 sec/batch
Epoch: 1/20...  Training Step: 5...  Training loss: 4.0513...  0.3574 sec/batch
Epoch: 1/20...  Training Step: 6...  Training loss: 3.8345...  0.3544 sec/batch
Epoch: 1/20...  Training Step: 7...  Training loss: 3.7139...  0.3632 sec/batch
Epoch: 1/20...  Training Step: 8...  Training loss: 3.5945...  0.3520 sec/batch
Epoch: 1/20...  Training Step: 9...  Training loss: 3.4947...  0.3564 sec/batch
Epoch: 1/20...  Training Step: 10...  Training loss: 3.4376...  0.3576 sec/batch
Epoch: 1/20...  Training Step: 11...  Training loss: 3.4050...  0.3852 sec/batch
Epoch: 1/20...  Training Step: 12...  Training loss: 3.3898...  0.3921 sec/batch
Epoch: 1/20...  Training Step: 13...  Training loss: 3.3698...  0.3826 sec/batch
Epoch: 1/20...  Training Step: 14...  Training loss: 3.3455...  0.3741 sec/batch
Epoch: 1/20...  Training Step: 15...  Training loss: 3.3303...  0.3741 sec/batch
Epoch: 1/20...  Training Step: 16...  Training loss: 3.3235...  0.3738 sec/batch
Epoch: 1/20...  Training Step: 17...  Training loss: 3.3029...  0.3777 sec/batch
Epoch: 1/20...  Training Step: 18...  Training loss: 3.2959...  0.3726 sec/batch
Epoch: 1/20...  Training Step: 19...  Training loss: 3.2772...  0.4057 sec/batch
Epoch: 1/20...  Training Step: 20...  Training loss: 3.2786...  0.3875 sec/batch
Epoch: 1/20...  Training Step: 21...  Training loss: 3.2739...  0.3666 sec/batch
Epoch: 1/20...  Training Step: 22...  Training loss: 3.2579...  0.3686 sec/batch
Epoch: 1/20...  Training Step: 23...  Training loss: 3.2487...  0.3621 sec/batch
Epoch: 1/20...  Training Step: 24...  Training loss: 3.2441...  0.3627 sec/batch
Epoch: 1/20...  Training Step: 25...  Training loss: 3.2464...  0.3647 sec/batch
Epoch: 1/20...  Training Step: 26...  Training loss: 3.2370...  0.3628 sec/batch
Epoch: 1/20...  Training Step: 27...  Training loss: 3.2353...  0.3672 sec/batch
Epoch: 1/20...  Training Step: 28...  Training loss: 3.2243...  0.3734 sec/batch
Epoch: 1/20...  Training Step: 29...  Training loss: 3.2268...  0.3604 sec/batch
Epoch: 1/20...  Training Step: 30...  Training loss: 3.2117...  0.3639 sec/batch
Epoch: 1/20...  Training Step: 31...  Training loss: 3.2202...  0.3618 sec/batch
Epoch: 1/20...  Training Step: 32...  Training loss: 3.2084...  0.3641 sec/batch
Epoch: 1/20...  Training Step: 33...  Training loss: 3.2037...  0.3627 sec/batch
Epoch: 2/20...  Training Step: 34...  Training loss: 3.2292...  0.3661 sec/batch
Epoch: 2/20...  Training Step: 35...  Training loss: 3.1807...  0.3679 sec/batch
Epoch: 2/20...  Training Step: 36...  Training loss: 3.1978...  0.3613 sec/batch
Epoch: 2/20...  Training Step: 37...  Training loss: 3.1966...  0.3646 sec/batch
Epoch: 2/20...  Training Step: 38...  Training loss: 3.1915...  0.3662 sec/batch
Epoch: 2/20...  Training Step: 39...  Training loss: 3.1849...  0.3637 sec/batch
Epoch: 2/20...  Training Step: 40...  Training loss: 3.1853...  0.3739 sec/batch
Epoch: 2/20...  Training Step: 41...  Training loss: 3.1936...  0.3644 sec/batch
Epoch: 2/20...  Training Step: 42...  Training loss: 3.1867...  0.3672 sec/batch
Epoch: 2/20...  Training Step: 43...  Training loss: 3.1833...  0.3639 sec/batch
Epoch: 2/20...  Training Step: 44...  Training loss: 3.1736...  0.3615 sec/batch
Epoch: 2/20...  Training Step: 45...  Training loss: 3.1760...  0.3632 sec/batch
Epoch: 2/20...  Training Step: 46...  Training loss: 3.1736...  0.3646 sec/batch
Epoch: 2/20...  Training Step: 47...  Training loss: 3.1698...  0.3621 sec/batch
Epoch: 2/20...  Training Step: 48...  Training loss: 3.1678...  0.3716 sec/batch
Epoch: 2/20...  Training Step: 49...  Training loss: 3.1704...  0.4316 sec/batch
Epoch: 2/20...  Training Step: 50...  Training loss: 3.1633...  0.3651 sec/batch
Epoch: 2/20...  Training Step: 51...  Training loss: 3.1691...  0.3715 sec/batch
Epoch: 2/20...  Training Step: 52...  Training loss: 3.1576...  0.3767 sec/batch
Epoch: 2/20...  Training Step: 53...  Training loss: 3.1655...  0.3770 sec/batch
Epoch: 2/20...  Training Step: 54...  Training loss: 3.1619...  0.3859 sec/batch
Epoch: 2/20...  Training Step: 55...  Training loss: 3.1562...  0.3765 sec/batch
Epoch: 2/20...  Training Step: 56...  Training loss: 3.1508...  0.3733 sec/batch
Epoch: 2/20...  Training Step: 57...  Training loss: 3.1491...  0.3748 sec/batch
Epoch: 2/20...  Training Step: 58...  Training loss: 3.1529...  0.3748 sec/batch
Epoch: 2/20...  Training Step: 59...  Training loss: 3.1529...  0.3758 sec/batch
Epoch: 2/20...  Training Step: 60...  Training loss: 3.1546...  0.3723 sec/batch
Epoch: 2/20...  Training Step: 61...  Training loss: 3.1508...  0.3729 sec/batch
Epoch: 2/20...  Training Step: 62...  Training loss: 3.1517...  0.3718 sec/batch
Epoch: 2/20...  Training Step: 63...  Training loss: 3.1357...  0.3753 sec/batch
Epoch: 2/20...  Training Step: 64...  Training loss: 3.1475...  0.3738 sec/batch
Epoch: 2/20...  Training Step: 65...  Training loss: 3.1365...  0.3826 sec/batch
Epoch: 2/20...  Training Step: 66...  Training loss: 3.1391...  0.3721 sec/batch
Epoch: 3/20...  Training Step: 67...  Training loss: 3.1606...  0.3743 sec/batch
Epoch: 3/20...  Training Step: 68...  Training loss: 3.1215...  0.3833 sec/batch
Epoch: 3/20...  Training Step: 69...  Training loss: 3.1382...  0.3721 sec/batch
Epoch: 3/20...  Training Step: 70...  Training loss: 3.1397...  0.3747 sec/batch
Epoch: 3/20...  Training Step: 71...  Training loss: 3.1367...  0.3746 sec/batch
Epoch: 3/20...  Training Step: 72...  Training loss: 3.1357...  0.3734 sec/batch
Epoch: 3/20...  Training Step: 73...  Training loss: 3.1442...  0.3720 sec/batch
Epoch: 3/20...  Training Step: 74...  Training loss: 3.1521...  0.3743 sec/batch
Epoch: 3/20...  Training Step: 75...  Training loss: 3.1433...  0.3729 sec/batch
Epoch: 3/20...  Training Step: 76...  Training loss: 3.1373...  0.3711 sec/batch
Epoch: 3/20...  Training Step: 77...  Training loss: 3.1321...  0.3674 sec/batch
Epoch: 3/20...  Training Step: 78...  Training loss: 3.1315...  0.3870 sec/batch
Epoch: 3/20...  Training Step: 79...  Training loss: 3.1301...  0.3980 sec/batch
Epoch: 3/20...  Training Step: 80...  Training loss: 3.1265...  0.4193 sec/batch
Epoch: 3/20...  Training Step: 81...  Training loss: 3.1277...  0.3746 sec/batch
Epoch: 3/20...  Training Step: 82...  Training loss: 3.1280...  0.3699 sec/batch
Epoch: 3/20...  Training Step: 83...  Training loss: 3.1215...  0.3690 sec/batch
Epoch: 3/20...  Training Step: 84...  Training loss: 3.1231...  0.3617 sec/batch
Epoch: 3/20...  Training Step: 85...  Training loss: 3.1134...  0.3545 sec/batch
Epoch: 3/20...  Training Step: 86...  Training loss: 3.1230...  0.3673 sec/batch
Epoch: 3/20...  Training Step: 87...  Training loss: 3.1225...  0.3558 sec/batch
Epoch: 3/20...  Training Step: 88...  Training loss: 3.1097...  0.3560 sec/batch
Epoch: 3/20...  Training Step: 89...  Training loss: 3.1076...  0.3538 sec/batch
Epoch: 3/20...  Training Step: 90...  Training loss: 3.1051...  0.3597 sec/batch
Epoch: 3/20...  Training Step: 91...  Training loss: 3.1096...  0.3645 sec/batch
Epoch: 3/20...  Training Step: 92...  Training loss: 3.1052...  0.3618 sec/batch
Epoch: 3/20...  Training Step: 93...  Training loss: 3.1097...  0.3704 sec/batch
Epoch: 3/20...  Training Step: 94...  Training loss: 3.1037...  0.3530 sec/batch
Epoch: 3/20...  Training Step: 95...  Training loss: 3.1016...  0.3572 sec/batch
Epoch: 3/20...  Training Step: 96...  Training loss: 3.0864...  0.3586 sec/batch
Epoch: 3/20...  Training Step: 97...  Training loss: 3.1011...  0.3572 sec/batch
Epoch: 3/20...  Training Step: 98...  Training loss: 3.0869...  0.3880 sec/batch
Epoch: 3/20...  Training Step: 99...  Training loss: 3.0856...  0.3777 sec/batch
Epoch: 4/20...  Training Step: 100...  Training loss: 3.1720...  0.3887 sec/batch
Epoch: 4/20...  Training Step: 101...  Training loss: 3.1359...  0.3596 sec/batch
Epoch: 4/20...  Training Step: 102...  Training loss: 3.1384...  0.3575 sec/batch
Epoch: 4/20...  Training Step: 103...  Training loss: 3.1321...  0.3750 sec/batch
Epoch: 4/20...  Training Step: 104...  Training loss: 3.1094...  0.3658 sec/batch
Epoch: 4/20...  Training Step: 105...  Training loss: 3.0731...  0.3846 sec/batch
Epoch: 4/20...  Training Step: 106...  Training loss: 3.0615...  0.3849 sec/batch
Epoch: 4/20...  Training Step: 107...  Training loss: 3.0697...  0.3826 sec/batch
Epoch: 4/20...  Training Step: 108...  Training loss: 3.0604...  0.3902 sec/batch
Epoch: 4/20...  Training Step: 109...  Training loss: 3.0680...  0.3737 sec/batch
Epoch: 4/20...  Training Step: 110...  Training loss: 3.1205...  0.3514 sec/batch
Epoch: 4/20...  Training Step: 111...  Training loss: 3.0942...  0.3517 sec/batch
Epoch: 4/20...  Training Step: 112...  Training loss: 3.0616...  0.3770 sec/batch
Epoch: 4/20...  Training Step: 113...  Training loss: 3.0671...  0.3763 sec/batch
Epoch: 4/20...  Training Step: 114...  Training loss: 3.0673...  0.3608 sec/batch
Epoch: 4/20...  Training Step: 115...  Training loss: 3.0458...  0.3615 sec/batch
Epoch: 4/20...  Training Step: 116...  Training loss: 3.0410...  0.3662 sec/batch
Epoch: 4/20...  Training Step: 117...  Training loss: 3.0497...  0.4094 sec/batch
Epoch: 4/20...  Training Step: 118...  Training loss: 3.0399...  0.3677 sec/batch
Epoch: 4/20...  Training Step: 119...  Training loss: 3.0395...  0.3579 sec/batch
Epoch: 4/20...  Training Step: 120...  Training loss: 3.0284...  0.3509 sec/batch
Epoch: 4/20...  Training Step: 121...  Training loss: 3.0144...  0.3669 sec/batch
Epoch: 4/20...  Training Step: 122...  Training loss: 3.0066...  0.3550 sec/batch
Epoch: 4/20...  Training Step: 123...  Training loss: 3.0030...  0.3516 sec/batch
Epoch: 4/20...  Training Step: 124...  Training loss: 2.9989...  0.3528 sec/batch
Epoch: 4/20...  Training Step: 125...  Training loss: 2.9855...  0.3581 sec/batch
Epoch: 4/20...  Training Step: 126...  Training loss: 2.9844...  0.3562 sec/batch
Epoch: 4/20...  Training Step: 127...  Training loss: 2.9716...  0.3513 sec/batch
Epoch: 4/20...  Training Step: 128...  Training loss: 2.9652...  0.3532 sec/batch
Epoch: 4/20...  Training Step: 129...  Training loss: 2.9382...  0.3535 sec/batch
Epoch: 4/20...  Training Step: 130...  Training loss: 2.9491...  0.3578 sec/batch
Epoch: 4/20...  Training Step: 131...  Training loss: 2.9278...  0.3498 sec/batch
Epoch: 4/20...  Training Step: 132...  Training loss: 2.9148...  0.3522 sec/batch
Epoch: 5/20...  Training Step: 133...  Training loss: 2.9268...  0.3511 sec/batch
Epoch: 5/20...  Training Step: 134...  Training loss: 2.8886...  0.3576 sec/batch
Epoch: 5/20...  Training Step: 135...  Training loss: 2.8902...  0.3679 sec/batch
Epoch: 5/20...  Training Step: 136...  Training loss: 2.8841...  0.3679 sec/batch
Epoch: 5/20...  Training Step: 137...  Training loss: 2.8850...  0.3560 sec/batch
Epoch: 5/20...  Training Step: 138...  Training loss: 3.0606...  0.3531 sec/batch
Epoch: 5/20...  Training Step: 139...  Training loss: 2.9012...  0.3528 sec/batch
Epoch: 5/20...  Training Step: 140...  Training loss: 2.9328...  0.3765 sec/batch
Epoch: 5/20...  Training Step: 141...  Training loss: 2.9058...  0.3529 sec/batch
Epoch: 5/20...  Training Step: 142...  Training loss: 2.8956...  0.3677 sec/batch
Epoch: 5/20...  Training Step: 143...  Training loss: 2.8845...  0.3668 sec/batch
Epoch: 5/20...  Training Step: 144...  Training loss: 2.8684...  0.3536 sec/batch
Epoch: 5/20...  Training Step: 145...  Training loss: 2.8627...  0.3563 sec/batch
Epoch: 5/20...  Training Step: 146...  Training loss: 2.8488...  0.3652 sec/batch
Epoch: 5/20...  Training Step: 147...  Training loss: 2.8380...  0.4028 sec/batch
Epoch: 5/20...  Training Step: 148...  Training loss: 2.8326...  0.3709 sec/batch
Epoch: 5/20...  Training Step: 149...  Training loss: 2.8190...  0.3726 sec/batch
Epoch: 5/20...  Training Step: 150...  Training loss: 2.8126...  0.3760 sec/batch
Epoch: 5/20...  Training Step: 151...  Training loss: 2.7916...  0.3631 sec/batch
Epoch: 5/20...  Training Step: 152...  Training loss: 2.7907...  0.3574 sec/batch
Epoch: 5/20...  Training Step: 153...  Training loss: 2.7835...  0.3586 sec/batch
Epoch: 5/20...  Training Step: 154...  Training loss: 2.7678...  0.3654 sec/batch
Epoch: 5/20...  Training Step: 155...  Training loss: 2.7507...  0.3630 sec/batch
Epoch: 5/20...  Training Step: 156...  Training loss: 2.7458...  0.3543 sec/batch
Epoch: 5/20...  Training Step: 157...  Training loss: 2.7346...  0.3531 sec/batch
Epoch: 5/20...  Training Step: 158...  Training loss: 2.7263...  0.3541 sec/batch
Epoch: 5/20...  Training Step: 159...  Training loss: 2.7287...  0.3573 sec/batch
Epoch: 5/20...  Training Step: 160...  Training loss: 2.7143...  0.3556 sec/batch
Epoch: 5/20...  Training Step: 161...  Training loss: 2.7167...  0.3539 sec/batch
Epoch: 5/20...  Training Step: 162...  Training loss: 2.6741...  0.3578 sec/batch
Epoch: 5/20...  Training Step: 163...  Training loss: 2.6918...  0.3574 sec/batch
Epoch: 5/20...  Training Step: 164...  Training loss: 2.6817...  0.3513 sec/batch
Epoch: 5/20...  Training Step: 165...  Training loss: 2.6609...  0.3519 sec/batch
Epoch: 6/20...  Training Step: 166...  Training loss: 2.6862...  0.3646 sec/batch
Epoch: 6/20...  Training Step: 167...  Training loss: 2.6353...  0.3568 sec/batch
Epoch: 6/20...  Training Step: 168...  Training loss: 2.6443...  0.3525 sec/batch
Epoch: 6/20...  Training Step: 169...  Training loss: 2.6327...  0.3547 sec/batch
Epoch: 6/20...  Training Step: 170...  Training loss: 2.6374...  0.3507 sec/batch
Epoch: 6/20...  Training Step: 171...  Training loss: 2.6143...  0.3558 sec/batch
Epoch: 6/20...  Training Step: 172...  Training loss: 2.6206...  0.3498 sec/batch
Epoch: 6/20...  Training Step: 173...  Training loss: 2.6082...  0.3581 sec/batch
Epoch: 6/20...  Training Step: 174...  Training loss: 2.5994...  0.3586 sec/batch
Epoch: 6/20...  Training Step: 175...  Training loss: 2.5945...  0.3587 sec/batch
Epoch: 6/20...  Training Step: 176...  Training loss: 2.5938...  0.3571 sec/batch
Epoch: 6/20...  Training Step: 177...  Training loss: 2.5778...  0.3586 sec/batch
Epoch: 6/20...  Training Step: 178...  Training loss: 2.5727...  0.3777 sec/batch
Epoch: 6/20...  Training Step: 179...  Training loss: 2.5590...  0.3789 sec/batch
Epoch: 6/20...  Training Step: 180...  Training loss: 2.5530...  0.3929 sec/batch
Epoch: 6/20...  Training Step: 181...  Training loss: 2.5504...  0.3692 sec/batch
Epoch: 6/20...  Training Step: 182...  Training loss: 2.5445...  0.3675 sec/batch
Epoch: 6/20...  Training Step: 183...  Training loss: 2.5461...  0.3765 sec/batch
Epoch: 6/20...  Training Step: 184...  Training loss: 2.5263...  0.3645 sec/batch
Epoch: 6/20...  Training Step: 185...  Training loss: 2.5334...  0.3873 sec/batch
Epoch: 6/20...  Training Step: 186...  Training loss: 2.5304...  0.3837 sec/batch
Epoch: 6/20...  Training Step: 187...  Training loss: 2.5207...  0.3810 sec/batch
Epoch: 6/20...  Training Step: 188...  Training loss: 2.5079...  0.3765 sec/batch
Epoch: 6/20...  Training Step: 189...  Training loss: 2.5073...  0.3879 sec/batch
Epoch: 6/20...  Training Step: 190...  Training loss: 2.5047...  0.3626 sec/batch
Epoch: 6/20...  Training Step: 191...  Training loss: 2.5072...  0.3685 sec/batch
Epoch: 6/20...  Training Step: 192...  Training loss: 2.5056...  0.3561 sec/batch
Epoch: 6/20...  Training Step: 193...  Training loss: 2.4896...  0.3625 sec/batch
Epoch: 6/20...  Training Step: 194...  Training loss: 2.4880...  0.3641 sec/batch
Epoch: 6/20...  Training Step: 195...  Training loss: 2.4753...  0.3517 sec/batch
Epoch: 6/20...  Training Step: 196...  Training loss: 2.4890...  0.3645 sec/batch
Epoch: 6/20...  Training Step: 197...  Training loss: 2.4802...  0.3679 sec/batch
Epoch: 6/20...  Training Step: 198...  Training loss: 2.4667...  0.3527 sec/batch
Epoch: 7/20...  Training Step: 199...  Training loss: 2.4944...  0.3598 sec/batch
Epoch: 7/20...  Training Step: 200...  Training loss: 2.4580...  0.3634 sec/batch
Epoch: 7/20...  Training Step: 201...  Training loss: 2.4669...  0.3619 sec/batch
Epoch: 7/20...  Training Step: 202...  Training loss: 2.4663...  0.3617 sec/batch
Epoch: 7/20...  Training Step: 203...  Training loss: 2.4689...  0.3542 sec/batch
Epoch: 7/20...  Training Step: 204...  Training loss: 2.4585...  0.3661 sec/batch
Epoch: 7/20...  Training Step: 205...  Training loss: 2.4617...  0.3524 sec/batch
Epoch: 7/20...  Training Step: 206...  Training loss: 2.4566...  0.3567 sec/batch
Epoch: 7/20...  Training Step: 207...  Training loss: 2.4490...  0.3591 sec/batch
Epoch: 7/20...  Training Step: 208...  Training loss: 2.4464...  0.3549 sec/batch
Epoch: 7/20...  Training Step: 209...  Training loss: 2.4534...  0.3512 sec/batch
Epoch: 7/20...  Training Step: 210...  Training loss: 2.4405...  0.3559 sec/batch
Epoch: 7/20...  Training Step: 211...  Training loss: 2.4375...  0.3552 sec/batch
Epoch: 7/20...  Training Step: 212...  Training loss: 2.4273...  0.3549 sec/batch
Epoch: 7/20...  Training Step: 213...  Training loss: 2.4308...  0.3656 sec/batch
Epoch: 7/20...  Training Step: 214...  Training loss: 2.4241...  0.3532 sec/batch
Epoch: 7/20...  Training Step: 215...  Training loss: 2.4219...  0.3522 sec/batch
Epoch: 7/20...  Training Step: 216...  Training loss: 2.4241...  0.3533 sec/batch
Epoch: 7/20...  Training Step: 217...  Training loss: 2.4041...  0.3649 sec/batch
Epoch: 7/20...  Training Step: 218...  Training loss: 2.4085...  0.3571 sec/batch
Epoch: 7/20...  Training Step: 219...  Training loss: 2.4153...  0.3534 sec/batch
Epoch: 7/20...  Training Step: 220...  Training loss: 2.4015...  0.3522 sec/batch
Epoch: 7/20...  Training Step: 221...  Training loss: 2.3966...  0.3520 sec/batch
Epoch: 7/20...  Training Step: 222...  Training loss: 2.3874...  0.3526 sec/batch
Epoch: 7/20...  Training Step: 223...  Training loss: 2.3936...  0.3636 sec/batch
Epoch: 7/20...  Training Step: 224...  Training loss: 2.3918...  0.3519 sec/batch
Epoch: 7/20...  Training Step: 225...  Training loss: 2.3902...  0.3590 sec/batch
Epoch: 7/20...  Training Step: 226...  Training loss: 2.3831...  0.3680 sec/batch
Epoch: 7/20...  Training Step: 227...  Training loss: 2.3777...  0.3621 sec/batch
Epoch: 7/20...  Training Step: 228...  Training loss: 2.3720...  0.3520 sec/batch
Epoch: 7/20...  Training Step: 229...  Training loss: 2.3890...  0.3595 sec/batch
Epoch: 7/20...  Training Step: 230...  Training loss: 2.3762...  0.3515 sec/batch
Epoch: 7/20...  Training Step: 231...  Training loss: 2.3651...  0.3628 sec/batch
Epoch: 8/20...  Training Step: 232...  Training loss: 2.3944...  0.4007 sec/batch
Epoch: 8/20...  Training Step: 233...  Training loss: 2.3571...  0.3857 sec/batch
Epoch: 8/20...  Training Step: 234...  Training loss: 2.3689...  0.3592 sec/batch
Epoch: 8/20...  Training Step: 235...  Training loss: 2.3740...  0.3546 sec/batch
Epoch: 8/20...  Training Step: 236...  Training loss: 2.3915...  0.3756 sec/batch
Epoch: 8/20...  Training Step: 237...  Training loss: 2.3749...  0.3916 sec/batch
Epoch: 8/20...  Training Step: 238...  Training loss: 2.3644...  0.3821 sec/batch
Epoch: 8/20...  Training Step: 239...  Training loss: 2.3683...  0.3790 sec/batch
Epoch: 8/20...  Training Step: 240...  Training loss: 2.3528...  0.3549 sec/batch
Epoch: 8/20...  Training Step: 241...  Training loss: 2.3593...  0.3694 sec/batch
Epoch: 8/20...  Training Step: 242...  Training loss: 2.3590...  0.3505 sec/batch
Epoch: 8/20...  Training Step: 243...  Training loss: 2.3430...  0.3548 sec/batch
Epoch: 8/20...  Training Step: 244...  Training loss: 2.3367...  0.3512 sec/batch
Epoch: 8/20...  Training Step: 245...  Training loss: 2.3348...  0.3511 sec/batch
Epoch: 8/20...  Training Step: 246...  Training loss: 2.3361...  0.3499 sec/batch
Epoch: 8/20...  Training Step: 247...  Training loss: 2.3338...  0.3654 sec/batch
Epoch: 8/20...  Training Step: 248...  Training loss: 2.3267...  0.3574 sec/batch
Epoch: 8/20...  Training Step: 249...  Training loss: 2.3348...  0.3530 sec/batch
Epoch: 8/20...  Training Step: 250...  Training loss: 2.3130...  0.3531 sec/batch
Epoch: 8/20...  Training Step: 251...  Training loss: 2.3120...  0.3513 sec/batch
Epoch: 8/20...  Training Step: 252...  Training loss: 2.3239...  0.3536 sec/batch
Epoch: 8/20...  Training Step: 253...  Training loss: 2.3119...  0.3510 sec/batch
Epoch: 8/20...  Training Step: 254...  Training loss: 2.3068...  0.3523 sec/batch
Epoch: 8/20...  Training Step: 255...  Training loss: 2.3009...  0.3553 sec/batch
Epoch: 8/20...  Training Step: 256...  Training loss: 2.2993...  0.3580 sec/batch
Epoch: 8/20...  Training Step: 257...  Training loss: 2.3060...  0.3542 sec/batch
Epoch: 8/20...  Training Step: 258...  Training loss: 2.3022...  0.3528 sec/batch
Epoch: 8/20...  Training Step: 259...  Training loss: 2.2943...  0.3497 sec/batch
Epoch: 8/20...  Training Step: 260...  Training loss: 2.2912...  0.3539 sec/batch
Epoch: 8/20...  Training Step: 261...  Training loss: 2.2868...  0.3532 sec/batch
Epoch: 8/20...  Training Step: 262...  Training loss: 2.3005...  0.3728 sec/batch
Epoch: 8/20...  Training Step: 263...  Training loss: 2.2903...  0.3548 sec/batch
Epoch: 8/20...  Training Step: 264...  Training loss: 2.2770...  0.3567 sec/batch
Epoch: 9/20...  Training Step: 265...  Training loss: 2.3122...  0.3505 sec/batch
Epoch: 9/20...  Training Step: 266...  Training loss: 2.2763...  0.3537 sec/batch
Epoch: 9/20...  Training Step: 267...  Training loss: 2.2906...  0.3697 sec/batch
Epoch: 9/20...  Training Step: 268...  Training loss: 2.2927...  0.3712 sec/batch
Epoch: 9/20...  Training Step: 269...  Training loss: 2.2931...  0.3705 sec/batch
Epoch: 9/20...  Training Step: 270...  Training loss: 2.2734...  0.3584 sec/batch
Epoch: 9/20...  Training Step: 271...  Training loss: 2.2786...  0.3673 sec/batch
Epoch: 9/20...  Training Step: 272...  Training loss: 2.2730...  0.3747 sec/batch
Epoch: 9/20...  Training Step: 273...  Training loss: 2.2628...  0.3917 sec/batch
Epoch: 9/20...  Training Step: 274...  Training loss: 2.2725...  0.3827 sec/batch
Epoch: 9/20...  Training Step: 275...  Training loss: 2.2720...  0.3615 sec/batch
Epoch: 9/20...  Training Step: 276...  Training loss: 2.2580...  0.3551 sec/batch
Epoch: 9/20...  Training Step: 277...  Training loss: 2.2538...  0.3651 sec/batch
Epoch: 9/20...  Training Step: 278...  Training loss: 2.2522...  0.3562 sec/batch
Epoch: 9/20...  Training Step: 279...  Training loss: 2.2555...  0.3592 sec/batch
Epoch: 9/20...  Training Step: 280...  Training loss: 2.2526...  0.3635 sec/batch
Epoch: 9/20...  Training Step: 281...  Training loss: 2.2444...  0.3530 sec/batch
Epoch: 9/20...  Training Step: 282...  Training loss: 2.2505...  0.3527 sec/batch
Epoch: 9/20...  Training Step: 283...  Training loss: 2.2317...  0.3531 sec/batch
Epoch: 9/20...  Training Step: 284...  Training loss: 2.2304...  0.3565 sec/batch
Epoch: 9/20...  Training Step: 285...  Training loss: 2.2429...  0.3577 sec/batch
Epoch: 9/20...  Training Step: 286...  Training loss: 2.2303...  0.3569 sec/batch
Epoch: 9/20...  Training Step: 287...  Training loss: 2.2244...  0.3592 sec/batch
Epoch: 9/20...  Training Step: 288...  Training loss: 2.2181...  0.3861 sec/batch
Epoch: 9/20...  Training Step: 289...  Training loss: 2.2193...  0.3797 sec/batch
Epoch: 9/20...  Training Step: 290...  Training loss: 2.2268...  0.3835 sec/batch
Epoch: 9/20...  Training Step: 291...  Training loss: 2.2232...  0.3648 sec/batch
Epoch: 9/20...  Training Step: 292...  Training loss: 2.2180...  0.3613 sec/batch
Epoch: 9/20...  Training Step: 293...  Training loss: 2.2200...  0.3693 sec/batch
Epoch: 9/20...  Training Step: 294...  Training loss: 2.2200...  0.3654 sec/batch
Epoch: 9/20...  Training Step: 295...  Training loss: 2.2230...  0.3574 sec/batch
Epoch: 9/20...  Training Step: 296...  Training loss: 2.2209...  0.3587 sec/batch
Epoch: 9/20...  Training Step: 297...  Training loss: 2.2033...  0.3615 sec/batch
Epoch: 10/20...  Training Step: 298...  Training loss: 2.2472...  0.3510 sec/batch
Epoch: 10/20...  Training Step: 299...  Training loss: 2.2072...  0.3538 sec/batch
Epoch: 10/20...  Training Step: 300...  Training loss: 2.2114...  0.3549 sec/batch
Epoch: 10/20...  Training Step: 301...  Training loss: 2.2130...  0.3563 sec/batch
Epoch: 10/20...  Training Step: 302...  Training loss: 2.2124...  0.3507 sec/batch
Epoch: 10/20...  Training Step: 303...  Training loss: 2.1965...  0.3527 sec/batch
Epoch: 10/20...  Training Step: 304...  Training loss: 2.2034...  0.3505 sec/batch
Epoch: 10/20...  Training Step: 305...  Training loss: 2.1991...  0.3528 sec/batch
Epoch: 10/20...  Training Step: 306...  Training loss: 2.1905...  0.3499 sec/batch
Epoch: 10/20...  Training Step: 307...  Training loss: 2.1917...  0.3569 sec/batch
Epoch: 10/20...  Training Step: 308...  Training loss: 2.2005...  0.3557 sec/batch
Epoch: 10/20...  Training Step: 309...  Training loss: 2.1890...  0.3555 sec/batch
Epoch: 10/20...  Training Step: 310...  Training loss: 2.1784...  0.3506 sec/batch
Epoch: 10/20...  Training Step: 311...  Training loss: 2.1757...  0.3547 sec/batch
Epoch: 10/20...  Training Step: 312...  Training loss: 2.1841...  0.3522 sec/batch
Epoch: 10/20...  Training Step: 313...  Training loss: 2.1804...  0.3529 sec/batch
Epoch: 10/20...  Training Step: 314...  Training loss: 2.1777...  0.3512 sec/batch
Epoch: 10/20...  Training Step: 315...  Training loss: 2.1833...  0.3567 sec/batch
Epoch: 10/20...  Training Step: 316...  Training loss: 2.1616...  0.3646 sec/batch
Epoch: 10/20...  Training Step: 317...  Training loss: 2.1567...  0.3530 sec/batch
Epoch: 10/20...  Training Step: 318...  Training loss: 2.1728...  0.3528 sec/batch
Epoch: 10/20...  Training Step: 319...  Training loss: 2.1610...  0.3543 sec/batch
Epoch: 10/20...  Training Step: 320...  Training loss: 2.1526...  0.3504 sec/batch
Epoch: 10/20...  Training Step: 321...  Training loss: 2.1493...  0.3549 sec/batch
Epoch: 10/20...  Training Step: 322...  Training loss: 2.1554...  0.3519 sec/batch
Epoch: 10/20...  Training Step: 323...  Training loss: 2.1621...  0.3591 sec/batch
Epoch: 10/20...  Training Step: 324...  Training loss: 2.1551...  0.3549 sec/batch
Epoch: 10/20...  Training Step: 325...  Training loss: 2.1479...  0.3544 sec/batch
Epoch: 10/20...  Training Step: 326...  Training loss: 2.1533...  0.3506 sec/batch
Epoch: 10/20...  Training Step: 327...  Training loss: 2.1420...  0.3542 sec/batch
Epoch: 10/20...  Training Step: 328...  Training loss: 2.1578...  0.3502 sec/batch
Epoch: 10/20...  Training Step: 329...  Training loss: 2.1528...  0.3533 sec/batch
Epoch: 10/20...  Training Step: 330...  Training loss: 2.1336...  0.3533 sec/batch
Epoch: 11/20...  Training Step: 331...  Training loss: 2.1733...  0.3566 sec/batch
Epoch: 11/20...  Training Step: 332...  Training loss: 2.1337...  0.3532 sec/batch
Epoch: 11/20...  Training Step: 333...  Training loss: 2.1463...  0.3668 sec/batch
Epoch: 11/20...  Training Step: 334...  Training loss: 2.1441...  0.3498 sec/batch
Epoch: 11/20...  Training Step: 335...  Training loss: 2.1521...  0.3543 sec/batch
Epoch: 11/20...  Training Step: 336...  Training loss: 2.1277...  0.3516 sec/batch
Epoch: 11/20...  Training Step: 337...  Training loss: 2.1371...  0.3540 sec/batch
Epoch: 11/20...  Training Step: 338...  Training loss: 2.1335...  0.3639 sec/batch
Epoch: 11/20...  Training Step: 339...  Training loss: 2.1257...  0.3587 sec/batch
Epoch: 11/20...  Training Step: 340...  Training loss: 2.1249...  0.3515 sec/batch
Epoch: 11/20...  Training Step: 341...  Training loss: 2.1308...  0.3542 sec/batch
Epoch: 11/20...  Training Step: 342...  Training loss: 2.1153...  0.3519 sec/batch
Epoch: 11/20...  Training Step: 343...  Training loss: 2.1121...  0.3535 sec/batch
Epoch: 11/20...  Training Step: 344...  Training loss: 2.1127...  0.3521 sec/batch
Epoch: 11/20...  Training Step: 345...  Training loss: 2.1219...  0.3559 sec/batch
Epoch: 11/20...  Training Step: 346...  Training loss: 2.1113...  0.3550 sec/batch
Epoch: 11/20...  Training Step: 347...  Training loss: 2.1082...  0.3550 sec/batch
Epoch: 11/20...  Training Step: 348...  Training loss: 2.1188...  0.3507 sec/batch
Epoch: 11/20...  Training Step: 349...  Training loss: 2.0927...  0.3533 sec/batch
Epoch: 11/20...  Training Step: 350...  Training loss: 2.0898...  0.3513 sec/batch
Epoch: 11/20...  Training Step: 351...  Training loss: 2.1059...  0.3521 sec/batch
Epoch: 11/20...  Training Step: 352...  Training loss: 2.0980...  0.3511 sec/batch
Epoch: 11/20...  Training Step: 353...  Training loss: 2.0899...  0.3595 sec/batch
Epoch: 11/20...  Training Step: 354...  Training loss: 2.0840...  0.3557 sec/batch
Epoch: 11/20...  Training Step: 355...  Training loss: 2.0915...  0.3547 sec/batch
Epoch: 11/20...  Training Step: 356...  Training loss: 2.0994...  0.3558 sec/batch
Epoch: 11/20...  Training Step: 357...  Training loss: 2.0888...  0.3551 sec/batch
Epoch: 11/20...  Training Step: 358...  Training loss: 2.0831...  0.3718 sec/batch
Epoch: 11/20...  Training Step: 359...  Training loss: 2.0884...  0.3838 sec/batch
Epoch: 11/20...  Training Step: 360...  Training loss: 2.0823...  0.3533 sec/batch
Epoch: 11/20...  Training Step: 361...  Training loss: 2.0997...  0.3538 sec/batch
Epoch: 11/20...  Training Step: 362...  Training loss: 2.0942...  0.3557 sec/batch
Epoch: 11/20...  Training Step: 363...  Training loss: 2.0723...  0.3529 sec/batch
Epoch: 12/20...  Training Step: 364...  Training loss: 2.1195...  0.3543 sec/batch
Epoch: 12/20...  Training Step: 365...  Training loss: 2.0753...  0.3505 sec/batch
Epoch: 12/20...  Training Step: 366...  Training loss: 2.0868...  0.3532 sec/batch
Epoch: 12/20...  Training Step: 367...  Training loss: 2.0910...  0.3525 sec/batch
Epoch: 12/20...  Training Step: 368...  Training loss: 2.0976...  0.3545 sec/batch
Epoch: 12/20...  Training Step: 369...  Training loss: 2.0707...  0.3557 sec/batch
Epoch: 12/20...  Training Step: 370...  Training loss: 2.0762...  0.3536 sec/batch
Epoch: 12/20...  Training Step: 371...  Training loss: 2.0735...  0.3520 sec/batch
Epoch: 12/20...  Training Step: 372...  Training loss: 2.0657...  0.3509 sec/batch
Epoch: 12/20...  Training Step: 373...  Training loss: 2.0720...  0.3522 sec/batch
Epoch: 12/20...  Training Step: 374...  Training loss: 2.0729...  0.3534 sec/batch
Epoch: 12/20...  Training Step: 375...  Training loss: 2.0611...  0.3632 sec/batch
Epoch: 12/20...  Training Step: 376...  Training loss: 2.0606...  0.3621 sec/batch
Epoch: 12/20...  Training Step: 377...  Training loss: 2.0536...  0.3641 sec/batch
Epoch: 12/20...  Training Step: 378...  Training loss: 2.0671...  0.3574 sec/batch
Epoch: 12/20...  Training Step: 379...  Training loss: 2.0570...  0.3658 sec/batch
Epoch: 12/20...  Training Step: 380...  Training loss: 2.0517...  0.3514 sec/batch
Epoch: 12/20...  Training Step: 381...  Training loss: 2.0609...  0.3616 sec/batch
Epoch: 12/20...  Training Step: 382...  Training loss: 2.0380...  0.3550 sec/batch
Epoch: 12/20...  Training Step: 383...  Training loss: 2.0320...  0.3557 sec/batch
Epoch: 12/20...  Training Step: 384...  Training loss: 2.0496...  0.3590 sec/batch
Epoch: 12/20...  Training Step: 385...  Training loss: 2.0437...  0.3584 sec/batch
Epoch: 12/20...  Training Step: 386...  Training loss: 2.0311...  0.3666 sec/batch
Epoch: 12/20...  Training Step: 387...  Training loss: 2.0246...  0.3578 sec/batch
Epoch: 12/20...  Training Step: 388...  Training loss: 2.0320...  0.3712 sec/batch
Epoch: 12/20...  Training Step: 389...  Training loss: 2.0442...  0.3716 sec/batch
Epoch: 12/20...  Training Step: 390...  Training loss: 2.0326...  0.3844 sec/batch
Epoch: 12/20...  Training Step: 391...  Training loss: 2.0289...  0.3878 sec/batch
Epoch: 12/20...  Training Step: 392...  Training loss: 2.0391...  0.3859 sec/batch
Epoch: 12/20...  Training Step: 393...  Training loss: 2.0252...  0.3689 sec/batch
Epoch: 12/20...  Training Step: 394...  Training loss: 2.0410...  0.3757 sec/batch
Epoch: 12/20...  Training Step: 395...  Training loss: 2.0318...  0.3843 sec/batch
Epoch: 12/20...  Training Step: 396...  Training loss: 2.0173...  0.3898 sec/batch
Epoch: 13/20...  Training Step: 397...  Training loss: 2.0615...  0.3764 sec/batch
Epoch: 13/20...  Training Step: 398...  Training loss: 2.0192...  0.3557 sec/batch
Epoch: 13/20...  Training Step: 399...  Training loss: 2.0231...  0.3649 sec/batch
Epoch: 13/20...  Training Step: 400...  Training loss: 2.0268...  0.4143 sec/batch
Epoch: 13/20...  Training Step: 401...  Training loss: 2.0340...  0.3573 sec/batch
Epoch: 13/20...  Training Step: 402...  Training loss: 2.0150...  0.3524 sec/batch
Epoch: 13/20...  Training Step: 403...  Training loss: 2.0177...  0.3638 sec/batch
Epoch: 13/20...  Training Step: 404...  Training loss: 2.0211...  0.3803 sec/batch
Epoch: 13/20...  Training Step: 405...  Training loss: 2.0115...  0.3589 sec/batch
Epoch: 13/20...  Training Step: 406...  Training loss: 2.0116...  0.3617 sec/batch
Epoch: 13/20...  Training Step: 407...  Training loss: 2.0197...  0.4215 sec/batch
Epoch: 13/20...  Training Step: 408...  Training loss: 2.0035...  0.4783 sec/batch
Epoch: 13/20...  Training Step: 409...  Training loss: 2.0086...  0.4098 sec/batch
Epoch: 13/20...  Training Step: 410...  Training loss: 2.0025...  0.3876 sec/batch
Epoch: 13/20...  Training Step: 411...  Training loss: 2.0179...  0.3602 sec/batch
Epoch: 13/20...  Training Step: 412...  Training loss: 2.0014...  0.3811 sec/batch
Epoch: 13/20...  Training Step: 413...  Training loss: 1.9990...  0.3748 sec/batch
Epoch: 13/20...  Training Step: 414...  Training loss: 2.0122...  0.3681 sec/batch
Epoch: 13/20...  Training Step: 415...  Training loss: 1.9876...  0.3654 sec/batch
Epoch: 13/20...  Training Step: 416...  Training loss: 1.9821...  0.3635 sec/batch
Epoch: 13/20...  Training Step: 417...  Training loss: 1.9984...  0.3694 sec/batch
Epoch: 13/20...  Training Step: 418...  Training loss: 1.9922...  0.3741 sec/batch
Epoch: 13/20...  Training Step: 419...  Training loss: 1.9817...  0.3758 sec/batch
Epoch: 13/20...  Training Step: 420...  Training loss: 1.9749...  0.3755 sec/batch
Epoch: 13/20...  Training Step: 421...  Training loss: 1.9799...  0.3724 sec/batch
Epoch: 13/20...  Training Step: 422...  Training loss: 1.9982...  0.3737 sec/batch
Epoch: 13/20...  Training Step: 423...  Training loss: 1.9794...  0.3794 sec/batch
Epoch: 13/20...  Training Step: 424...  Training loss: 1.9770...  0.3623 sec/batch
Epoch: 13/20...  Training Step: 425...  Training loss: 1.9839...  0.4111 sec/batch
Epoch: 13/20...  Training Step: 426...  Training loss: 1.9718...  0.4319 sec/batch
Epoch: 13/20...  Training Step: 427...  Training loss: 1.9925...  0.3806 sec/batch
Epoch: 13/20...  Training Step: 428...  Training loss: 1.9852...  0.3632 sec/batch
Epoch: 13/20...  Training Step: 429...  Training loss: 1.9698...  0.3658 sec/batch
Epoch: 14/20...  Training Step: 430...  Training loss: 2.0121...  0.3612 sec/batch
Epoch: 14/20...  Training Step: 431...  Training loss: 1.9699...  0.3647 sec/batch
Epoch: 14/20...  Training Step: 432...  Training loss: 1.9756...  0.4213 sec/batch
Epoch: 14/20...  Training Step: 433...  Training loss: 1.9798...  0.3703 sec/batch
Epoch: 14/20...  Training Step: 434...  Training loss: 1.9835...  0.3642 sec/batch
Epoch: 14/20...  Training Step: 435...  Training loss: 1.9635...  0.3658 sec/batch
Epoch: 14/20...  Training Step: 436...  Training loss: 1.9654...  0.3658 sec/batch
Epoch: 14/20...  Training Step: 437...  Training loss: 1.9714...  0.3633 sec/batch
Epoch: 14/20...  Training Step: 438...  Training loss: 1.9740...  0.3733 sec/batch
Epoch: 14/20...  Training Step: 439...  Training loss: 1.9646...  0.3661 sec/batch
Epoch: 14/20...  Training Step: 440...  Training loss: 1.9765...  0.3677 sec/batch
Epoch: 14/20...  Training Step: 441...  Training loss: 1.9721...  0.3664 sec/batch
Epoch: 14/20...  Training Step: 442...  Training loss: 1.9735...  0.3633 sec/batch
Epoch: 14/20...  Training Step: 443...  Training loss: 1.9694...  0.3626 sec/batch
Epoch: 14/20...  Training Step: 444...  Training loss: 1.9822...  0.3668 sec/batch
Epoch: 14/20...  Training Step: 445...  Training loss: 1.9720...  0.3654 sec/batch
Epoch: 14/20...  Training Step: 446...  Training loss: 1.9577...  0.3657 sec/batch
Epoch: 14/20...  Training Step: 447...  Training loss: 1.9783...  0.3623 sec/batch
Epoch: 14/20...  Training Step: 448...  Training loss: 1.9532...  0.3658 sec/batch
Epoch: 14/20...  Training Step: 449...  Training loss: 1.9445...  0.3639 sec/batch
Epoch: 14/20...  Training Step: 450...  Training loss: 1.9610...  0.3628 sec/batch
Epoch: 14/20...  Training Step: 451...  Training loss: 1.9503...  0.3627 sec/batch
Epoch: 14/20...  Training Step: 452...  Training loss: 1.9459...  0.3624 sec/batch
Epoch: 14/20...  Training Step: 453...  Training loss: 1.9323...  0.3619 sec/batch
Epoch: 14/20...  Training Step: 454...  Training loss: 1.9465...  0.3639 sec/batch
Epoch: 14/20...  Training Step: 455...  Training loss: 1.9528...  0.3651 sec/batch
Epoch: 14/20...  Training Step: 456...  Training loss: 1.9405...  0.3677 sec/batch
Epoch: 14/20...  Training Step: 457...  Training loss: 1.9367...  0.3640 sec/batch
Epoch: 14/20...  Training Step: 458...  Training loss: 1.9432...  0.3614 sec/batch
Epoch: 14/20...  Training Step: 459...  Training loss: 1.9364...  0.3629 sec/batch
Epoch: 14/20...  Training Step: 460...  Training loss: 1.9466...  0.3626 sec/batch
Epoch: 14/20...  Training Step: 461...  Training loss: 1.9419...  0.3644 sec/batch
Epoch: 14/20...  Training Step: 462...  Training loss: 1.9252...  0.3681 sec/batch
Epoch: 15/20...  Training Step: 463...  Training loss: 1.9702...  0.3684 sec/batch
Epoch: 15/20...  Training Step: 464...  Training loss: 1.9369...  0.3656 sec/batch
Epoch: 15/20...  Training Step: 465...  Training loss: 1.9552...  0.3656 sec/batch
Epoch: 15/20...  Training Step: 466...  Training loss: 1.9490...  0.3692 sec/batch
Epoch: 15/20...  Training Step: 467...  Training loss: 1.9487...  0.3660 sec/batch
Epoch: 15/20...  Training Step: 468...  Training loss: 1.9341...  0.3633 sec/batch
Epoch: 15/20...  Training Step: 469...  Training loss: 1.9305...  0.3674 sec/batch
Epoch: 15/20...  Training Step: 470...  Training loss: 1.9244...  0.3702 sec/batch
Epoch: 15/20...  Training Step: 471...  Training loss: 1.9263...  0.3694 sec/batch
Epoch: 15/20...  Training Step: 472...  Training loss: 1.9232...  0.3666 sec/batch
Epoch: 15/20...  Training Step: 473...  Training loss: 1.9319...  0.3985 sec/batch
Epoch: 15/20...  Training Step: 474...  Training loss: 1.9129...  0.3660 sec/batch
Epoch: 15/20...  Training Step: 475...  Training loss: 1.9159...  0.3653 sec/batch
Epoch: 15/20...  Training Step: 476...  Training loss: 1.9100...  0.3632 sec/batch
Epoch: 15/20...  Training Step: 477...  Training loss: 1.9276...  0.3654 sec/batch
Epoch: 15/20...  Training Step: 478...  Training loss: 1.9147...  0.3668 sec/batch
Epoch: 15/20...  Training Step: 479...  Training loss: 1.9080...  0.3741 sec/batch
Epoch: 15/20...  Training Step: 480...  Training loss: 1.9212...  0.3628 sec/batch
Epoch: 15/20...  Training Step: 481...  Training loss: 1.9001...  0.3634 sec/batch
Epoch: 15/20...  Training Step: 482...  Training loss: 1.8896...  0.3622 sec/batch
Epoch: 15/20...  Training Step: 483...  Training loss: 1.9052...  0.3630 sec/batch
Epoch: 15/20...  Training Step: 484...  Training loss: 1.9073...  0.3666 sec/batch
Epoch: 15/20...  Training Step: 485...  Training loss: 1.8917...  0.3685 sec/batch
Epoch: 15/20...  Training Step: 486...  Training loss: 1.8824...  0.3677 sec/batch
Epoch: 15/20...  Training Step: 487...  Training loss: 1.8947...  0.3658 sec/batch
Epoch: 15/20...  Training Step: 488...  Training loss: 1.9087...  0.3633 sec/batch
Epoch: 15/20...  Training Step: 489...  Training loss: 1.8931...  0.3642 sec/batch
Epoch: 15/20...  Training Step: 490...  Training loss: 1.8887...  0.3634 sec/batch
Epoch: 15/20...  Training Step: 491...  Training loss: 1.8949...  0.3637 sec/batch
Epoch: 15/20...  Training Step: 492...  Training loss: 1.8906...  0.3676 sec/batch
Epoch: 15/20...  Training Step: 493...  Training loss: 1.9039...  0.3660 sec/batch
Epoch: 15/20...  Training Step: 494...  Training loss: 1.8950...  0.3636 sec/batch
Epoch: 15/20...  Training Step: 495...  Training loss: 1.8794...  0.3617 sec/batch
Epoch: 16/20...  Training Step: 496...  Training loss: 1.9284...  0.3637 sec/batch
Epoch: 16/20...  Training Step: 497...  Training loss: 1.8831...  0.3649 sec/batch
Epoch: 16/20...  Training Step: 498...  Training loss: 1.8909...  0.3621 sec/batch
Epoch: 16/20...  Training Step: 499...  Training loss: 1.8903...  0.3685 sec/batch
Epoch: 16/20...  Training Step: 500...  Training loss: 1.8938...  0.3681 sec/batch
Epoch: 16/20...  Training Step: 501...  Training loss: 1.8751...  0.3677 sec/batch
Epoch: 16/20...  Training Step: 502...  Training loss: 1.8789...  0.3649 sec/batch
Epoch: 16/20...  Training Step: 503...  Training loss: 1.8827...  0.3646 sec/batch
Epoch: 16/20...  Training Step: 504...  Training loss: 1.8730...  0.3625 sec/batch
Epoch: 16/20...  Training Step: 505...  Training loss: 1.8711...  0.3742 sec/batch
Epoch: 16/20...  Training Step: 506...  Training loss: 1.8808...  0.3649 sec/batch
Epoch: 16/20...  Training Step: 507...  Training loss: 1.8717...  0.3648 sec/batch
Epoch: 16/20...  Training Step: 508...  Training loss: 1.8661...  0.3678 sec/batch
Epoch: 16/20...  Training Step: 509...  Training loss: 1.8646...  0.3634 sec/batch
Epoch: 16/20...  Training Step: 510...  Training loss: 1.8808...  0.3650 sec/batch
Epoch: 16/20...  Training Step: 511...  Training loss: 1.8712...  0.3634 sec/batch
Epoch: 16/20...  Training Step: 512...  Training loss: 1.8632...  0.3605 sec/batch
Epoch: 16/20...  Training Step: 513...  Training loss: 1.8791...  0.3654 sec/batch
Epoch: 16/20...  Training Step: 514...  Training loss: 1.8540...  0.3695 sec/batch
Epoch: 16/20...  Training Step: 515...  Training loss: 1.8486...  0.3673 sec/batch
Epoch: 16/20...  Training Step: 516...  Training loss: 1.8671...  0.3665 sec/batch
Epoch: 16/20...  Training Step: 517...  Training loss: 1.8616...  0.3638 sec/batch
Epoch: 16/20...  Training Step: 518...  Training loss: 1.8526...  0.3623 sec/batch
Epoch: 16/20...  Training Step: 519...  Training loss: 1.8451...  0.3655 sec/batch
Epoch: 16/20...  Training Step: 520...  Training loss: 1.8510...  0.3714 sec/batch
Epoch: 16/20...  Training Step: 521...  Training loss: 1.8637...  0.3672 sec/batch
Epoch: 16/20...  Training Step: 522...  Training loss: 1.8541...  0.3701 sec/batch
Epoch: 16/20...  Training Step: 523...  Training loss: 1.8534...  0.3685 sec/batch
Epoch: 16/20...  Training Step: 524...  Training loss: 1.8574...  0.3629 sec/batch
Epoch: 16/20...  Training Step: 525...  Training loss: 1.8485...  0.3649 sec/batch
Epoch: 16/20...  Training Step: 526...  Training loss: 1.8633...  0.3632 sec/batch
Epoch: 16/20...  Training Step: 527...  Training loss: 1.8577...  0.3654 sec/batch
Epoch: 16/20...  Training Step: 528...  Training loss: 1.8426...  0.3628 sec/batch
Epoch: 17/20...  Training Step: 529...  Training loss: 1.8899...  0.3684 sec/batch
Epoch: 17/20...  Training Step: 530...  Training loss: 1.8441...  0.3684 sec/batch
Epoch: 17/20...  Training Step: 531...  Training loss: 1.8544...  0.3602 sec/batch
Epoch: 17/20...  Training Step: 532...  Training loss: 1.8508...  0.3645 sec/batch
Epoch: 17/20...  Training Step: 533...  Training loss: 1.8567...  0.3634 sec/batch
Epoch: 17/20...  Training Step: 534...  Training loss: 1.8378...  0.3622 sec/batch
Epoch: 17/20...  Training Step: 535...  Training loss: 1.8416...  0.3653 sec/batch
Epoch: 17/20...  Training Step: 536...  Training loss: 1.8441...  0.3643 sec/batch
Epoch: 17/20...  Training Step: 537...  Training loss: 1.8438...  0.3692 sec/batch
Epoch: 17/20...  Training Step: 538...  Training loss: 1.8358...  0.3640 sec/batch
Epoch: 17/20...  Training Step: 539...  Training loss: 1.8414...  0.3618 sec/batch
Epoch: 17/20...  Training Step: 540...  Training loss: 1.8307...  0.3661 sec/batch
Epoch: 17/20...  Training Step: 541...  Training loss: 1.8306...  0.3616 sec/batch
Epoch: 17/20...  Training Step: 542...  Training loss: 1.8223...  0.3634 sec/batch
Epoch: 17/20...  Training Step: 543...  Training loss: 1.8451...  0.3657 sec/batch
Epoch: 17/20...  Training Step: 544...  Training loss: 1.8296...  0.3641 sec/batch
Epoch: 17/20...  Training Step: 545...  Training loss: 1.8255...  0.3655 sec/batch
Epoch: 17/20...  Training Step: 546...  Training loss: 1.8415...  0.3656 sec/batch
Epoch: 17/20...  Training Step: 547...  Training loss: 1.8195...  0.3616 sec/batch
Epoch: 17/20...  Training Step: 548...  Training loss: 1.8049...  0.3651 sec/batch
Epoch: 17/20...  Training Step: 549...  Training loss: 1.8284...  0.3631 sec/batch
Epoch: 17/20...  Training Step: 550...  Training loss: 1.8217...  0.3632 sec/batch
Epoch: 17/20...  Training Step: 551...  Training loss: 1.8148...  0.3706 sec/batch
Epoch: 17/20...  Training Step: 552...  Training loss: 1.8062...  0.3703 sec/batch
Epoch: 17/20...  Training Step: 553...  Training loss: 1.8129...  0.3765 sec/batch
Epoch: 17/20...  Training Step: 554...  Training loss: 1.8266...  0.3713 sec/batch
Epoch: 17/20...  Training Step: 555...  Training loss: 1.8175...  0.3673 sec/batch
Epoch: 17/20...  Training Step: 556...  Training loss: 1.8140...  0.3735 sec/batch
Epoch: 17/20...  Training Step: 557...  Training loss: 1.8168...  0.3793 sec/batch
Epoch: 17/20...  Training Step: 558...  Training loss: 1.8099...  0.3749 sec/batch
Epoch: 17/20...  Training Step: 559...  Training loss: 1.8279...  0.4215 sec/batch
Epoch: 17/20...  Training Step: 560...  Training loss: 1.8196...  0.3678 sec/batch
Epoch: 17/20...  Training Step: 561...  Training loss: 1.8001...  0.3737 sec/batch
Epoch: 18/20...  Training Step: 562...  Training loss: 1.8575...  0.3981 sec/batch
Epoch: 18/20...  Training Step: 563...  Training loss: 1.8122...  0.3900 sec/batch
Epoch: 18/20...  Training Step: 564...  Training loss: 1.8164...  0.3726 sec/batch
Epoch: 18/20...  Training Step: 565...  Training loss: 1.8217...  0.3822 sec/batch
Epoch: 18/20...  Training Step: 566...  Training loss: 1.8220...  0.3743 sec/batch
Epoch: 18/20...  Training Step: 567...  Training loss: 1.8011...  0.3750 sec/batch
Epoch: 18/20...  Training Step: 568...  Training loss: 1.8067...  0.3631 sec/batch
Epoch: 18/20...  Training Step: 569...  Training loss: 1.8035...  0.3622 sec/batch
Epoch: 18/20...  Training Step: 570...  Training loss: 1.8064...  0.3679 sec/batch
Epoch: 18/20...  Training Step: 571...  Training loss: 1.8011...  0.3621 sec/batch
Epoch: 18/20...  Training Step: 572...  Training loss: 1.8066...  0.3681 sec/batch
Epoch: 18/20...  Training Step: 573...  Training loss: 1.7989...  0.3656 sec/batch
Epoch: 18/20...  Training Step: 574...  Training loss: 1.7942...  0.3615 sec/batch
Epoch: 18/20...  Training Step: 575...  Training loss: 1.7911...  0.3902 sec/batch
Epoch: 18/20...  Training Step: 576...  Training loss: 1.8105...  0.3646 sec/batch
Epoch: 18/20...  Training Step: 577...  Training loss: 1.7991...  0.3640 sec/batch
Epoch: 18/20...  Training Step: 578...  Training loss: 1.7964...  0.3639 sec/batch
Epoch: 18/20...  Training Step: 579...  Training loss: 1.8112...  0.3787 sec/batch
Epoch: 18/20...  Training Step: 580...  Training loss: 1.7848...  0.3748 sec/batch
Epoch: 18/20...  Training Step: 581...  Training loss: 1.7736...  0.3770 sec/batch
Epoch: 18/20...  Training Step: 582...  Training loss: 1.7948...  0.3773 sec/batch
Epoch: 18/20...  Training Step: 583...  Training loss: 1.7926...  0.3747 sec/batch
Epoch: 18/20...  Training Step: 584...  Training loss: 1.7789...  0.3749 sec/batch
Epoch: 18/20...  Training Step: 585...  Training loss: 1.7754...  0.3783 sec/batch
Epoch: 18/20...  Training Step: 586...  Training loss: 1.7849...  0.3772 sec/batch
Epoch: 18/20...  Training Step: 587...  Training loss: 1.7976...  0.3783 sec/batch
Epoch: 18/20...  Training Step: 588...  Training loss: 1.7842...  0.3699 sec/batch
Epoch: 18/20...  Training Step: 589...  Training loss: 1.7786...  0.3707 sec/batch
Epoch: 18/20...  Training Step: 590...  Training loss: 1.7889...  0.3649 sec/batch
Epoch: 18/20...  Training Step: 591...  Training loss: 1.7742...  0.3595 sec/batch
Epoch: 18/20...  Training Step: 592...  Training loss: 1.7955...  0.3960 sec/batch
Epoch: 18/20...  Training Step: 593...  Training loss: 1.7877...  0.3763 sec/batch
Epoch: 18/20...  Training Step: 594...  Training loss: 1.7711...  0.3831 sec/batch
Epoch: 19/20...  Training Step: 595...  Training loss: 1.8223...  0.3836 sec/batch
Epoch: 19/20...  Training Step: 596...  Training loss: 1.7795...  0.3676 sec/batch
Epoch: 19/20...  Training Step: 597...  Training loss: 1.7936...  0.3681 sec/batch
Epoch: 19/20...  Training Step: 598...  Training loss: 1.7899...  0.3638 sec/batch
Epoch: 19/20...  Training Step: 599...  Training loss: 1.7991...  0.3632 sec/batch
Epoch: 19/20...  Training Step: 600...  Training loss: 1.7774...  0.3636 sec/batch
Epoch: 19/20...  Training Step: 601...  Training loss: 1.7790...  0.3719 sec/batch
Epoch: 19/20...  Training Step: 602...  Training loss: 1.7776...  0.3672 sec/batch
Epoch: 19/20...  Training Step: 603...  Training loss: 1.7801...  0.3649 sec/batch
Epoch: 19/20...  Training Step: 604...  Training loss: 1.7741...  0.3621 sec/batch
Epoch: 19/20...  Training Step: 605...  Training loss: 1.7779...  0.3651 sec/batch
Epoch: 19/20...  Training Step: 606...  Training loss: 1.7665...  0.3644 sec/batch
Epoch: 19/20...  Training Step: 607...  Training loss: 1.7630...  0.3613 sec/batch
Epoch: 19/20...  Training Step: 608...  Training loss: 1.7609...  0.3652 sec/batch
Epoch: 19/20...  Training Step: 609...  Training loss: 1.7821...  0.3642 sec/batch
Epoch: 19/20...  Training Step: 610...  Training loss: 1.7669...  0.3670 sec/batch
Epoch: 19/20...  Training Step: 611...  Training loss: 1.7640...  0.3628 sec/batch
Epoch: 19/20...  Training Step: 612...  Training loss: 1.7780...  0.3603 sec/batch
Epoch: 19/20...  Training Step: 613...  Training loss: 1.7476...  0.3647 sec/batch
Epoch: 19/20...  Training Step: 614...  Training loss: 1.7435...  0.3624 sec/batch
Epoch: 19/20...  Training Step: 615...  Training loss: 1.7639...  0.3641 sec/batch
Epoch: 19/20...  Training Step: 616...  Training loss: 1.7570...  0.3691 sec/batch
Epoch: 19/20...  Training Step: 617...  Training loss: 1.7521...  0.3663 sec/batch
Epoch: 19/20...  Training Step: 618...  Training loss: 1.7447...  0.3627 sec/batch
Epoch: 19/20...  Training Step: 619...  Training loss: 1.7532...  0.3646 sec/batch
Epoch: 19/20...  Training Step: 620...  Training loss: 1.7668...  0.3634 sec/batch
Epoch: 19/20...  Training Step: 621...  Training loss: 1.7506...  0.3640 sec/batch
Epoch: 19/20...  Training Step: 622...  Training loss: 1.7510...  0.3606 sec/batch
Epoch: 19/20...  Training Step: 623...  Training loss: 1.7528...  0.3684 sec/batch
Epoch: 19/20...  Training Step: 624...  Training loss: 1.7464...  0.3691 sec/batch
Epoch: 19/20...  Training Step: 625...  Training loss: 1.7689...  0.3642 sec/batch
Epoch: 19/20...  Training Step: 626...  Training loss: 1.7551...  0.3638 sec/batch
Epoch: 19/20...  Training Step: 627...  Training loss: 1.7398...  0.3628 sec/batch
Epoch: 20/20...  Training Step: 628...  Training loss: 1.7927...  0.3635 sec/batch
Epoch: 20/20...  Training Step: 629...  Training loss: 1.7500...  0.3637 sec/batch
Epoch: 20/20...  Training Step: 630...  Training loss: 1.7561...  0.3616 sec/batch
Epoch: 20/20...  Training Step: 631...  Training loss: 1.7560...  0.3662 sec/batch
Epoch: 20/20...  Training Step: 632...  Training loss: 1.7569...  0.3628 sec/batch
Epoch: 20/20...  Training Step: 633...  Training loss: 1.7410...  0.3659 sec/batch
Epoch: 20/20...  Training Step: 634...  Training loss: 1.7459...  0.3660 sec/batch
Epoch: 20/20...  Training Step: 635...  Training loss: 1.7449...  0.3640 sec/batch
Epoch: 20/20...  Training Step: 636...  Training loss: 1.7431...  0.3670 sec/batch
Epoch: 20/20...  Training Step: 637...  Training loss: 1.7414...  0.3637 sec/batch
Epoch: 20/20...  Training Step: 638...  Training loss: 1.7444...  0.3669 sec/batch
Epoch: 20/20...  Training Step: 639...  Training loss: 1.7323...  0.3680 sec/batch
Epoch: 20/20...  Training Step: 640...  Training loss: 1.7338...  0.3624 sec/batch
Epoch: 20/20...  Training Step: 641...  Training loss: 1.7282...  0.3648 sec/batch
Epoch: 20/20...  Training Step: 642...  Training loss: 1.7491...  0.3749 sec/batch
Epoch: 20/20...  Training Step: 643...  Training loss: 1.7337...  0.3629 sec/batch
Epoch: 20/20...  Training Step: 644...  Training loss: 1.7311...  0.3649 sec/batch
Epoch: 20/20...  Training Step: 645...  Training loss: 1.7474...  0.3667 sec/batch
Epoch: 20/20...  Training Step: 646...  Training loss: 1.7203...  0.3677 sec/batch
Epoch: 20/20...  Training Step: 647...  Training loss: 1.7177...  0.3780 sec/batch
Epoch: 20/20...  Training Step: 648...  Training loss: 1.7371...  0.3605 sec/batch
Epoch: 20/20...  Training Step: 649...  Training loss: 1.7319...  0.3776 sec/batch
Epoch: 20/20...  Training Step: 650...  Training loss: 1.7236...  0.3784 sec/batch
Epoch: 20/20...  Training Step: 651...  Training loss: 1.7142...  0.3928 sec/batch
Epoch: 20/20...  Training Step: 652...  Training loss: 1.7204...  0.3700 sec/batch
Epoch: 20/20...  Training Step: 653...  Training loss: 1.7345...  0.3746 sec/batch
Epoch: 20/20...  Training Step: 654...  Training loss: 1.7224...  0.4215 sec/batch
Epoch: 20/20...  Training Step: 655...  Training loss: 1.7186...  0.4279 sec/batch
Epoch: 20/20...  Training Step: 656...  Training loss: 1.7249...  0.4071 sec/batch
Epoch: 20/20...  Training Step: 657...  Training loss: 1.7168...  0.3756 sec/batch
Epoch: 20/20...  Training Step: 658...  Training loss: 1.7346...  0.3732 sec/batch
Epoch: 20/20...  Training Step: 659...  Training loss: 1.7277...  0.3785 sec/batch
Epoch: 20/20...  Training Step: 660...  Training loss: 1.7105...  0.3902 sec/batch

Saved checkpoints

Read up on saving and loading checkpoints here: https://www.tensorflow.org/programmers_guide/variables


In [46]:
tf.train.get_checkpoint_state('checkpoints')


Out[46]:
model_checkpoint_path: "checkpoints/i1320_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i200_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i400_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i600_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i800_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i1000_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i1200_l500.ckpt"
all_model_checkpoint_paths: "checkpoints/i1320_l500.ckpt"

Sampling

Now that the network is trained, we'll can use it to generate new text. The idea is that we pass in a character, then the network will predict the next character. We can use the new one, to predict the next one. And we keep doing this to generate all new text. I also included some functionality to prime the network with some text by passing in a string and building up a state from that.

The network gives us predictions for each character. To reduce noise and make things a little less random, I'm going to only choose a new character from the top N most likely characters.


In [47]:
def pick_top_n(preds, vocab_size, top_n=5):
    p = np.squeeze(preds)
    p[np.argsort(p)[:-top_n]] = 0
    p = p / np.sum(p)
    c = np.random.choice(vocab_size, 1, p=p)[0]
    return c

In [48]:
def sample(checkpoint, n_samples, lstm_size, vocab_size, prime="The "):
    samples = [c for c in prime]
    model = CharRNN(len(vocab), lstm_size=lstm_size, sampling=True)
    saver = tf.train.Saver()
    with tf.Session() as sess:
        saver.restore(sess, checkpoint)
        new_state = sess.run(model.initial_state)
        for c in prime:
            x = np.zeros((1, 1))
            x[0,0] = vocab_to_int[c]
            feed = {model.inputs: x,
                    model.keep_prob: 1.,
                    model.initial_state: new_state}
            preds, new_state = sess.run([model.prediction, model.final_state], 
                                         feed_dict=feed)

        c = pick_top_n(preds, len(vocab))
        samples.append(int_to_vocab[c])

        for i in range(n_samples):
            x[0,0] = c
            feed = {model.inputs: x,
                    model.keep_prob: 1.,
                    model.initial_state: new_state}
            preds, new_state = sess.run([model.prediction, model.final_state], 
                                         feed_dict=feed)

            c = pick_top_n(preds, len(vocab))
            samples.append(int_to_vocab[c])
        
    return ''.join(samples)

Here, pass in the path to a checkpoint and sample from the network.


In [49]:
tf.train.latest_checkpoint('checkpoints')


Out[49]:
'checkpoints/i1320_l500.ckpt'

In [50]:
checkpoint = tf.train.latest_checkpoint('checkpoints')
samp = sample(checkpoint, 2000, lstm_size, len(vocab), prime="Far")
print(samp)


INFO:tensorflow:Restoring parameters from checkpoints/i1320_l500.ckpt
Farted; then the
comman and he came a district, and how in all the
posert of the sensites of an ondy the country was
in the werd at the proponer of her thing all the was she with shake of her husband, and sent of his, thinged with the
woman of steps.

"You're asked at her in it. Whet has butt or her
face and to me," said Sergey Ivanovitch.

"When there and you told her? I'm not
the miliciation."

"Oh, walking of me which that I were it to have began, and, she
could shate happened and
then their allow, to her. I won't take off this mentions, then,
I'm not
briend. When you well, and I could her humor, that it is any tell thes heart and the courtian, that it's the sermstice of the supper. The crees and his better, and that they would see her the meeding of their manse. And I'm as though. And to do be
do so than ansoun interest, be as imagine it a sand that
she changed hurry from the passess of such there with his mother. Her honsile, and the chostes, the peasants he changed to say to her his heart.

He caught in the chinding that their carriage would be the brother, whith talking he had so the stuck
of all her fores, and was at
him were to
stay. That had astented theme, who had nat to his
faith, who had been at her fightent, and to believe his stall of
her ferling of a low the children with a
seath of the son in the stand, but
that he was said, but whom had
think obe that had been believed that he was, how he said,
taking at the matter that in the
counting house that in her house, as he would be all the class of his worked at him.

"What's all those in the moment to her, and I'll see
in the say of their capper of the same
the said to seak it the
comprethion." she said to him that the princiss was not and the mother, and
the peasants were, to the carriage and
the starrs, and asked her and a stounce.

"And he could not conserve them. They
could not be servated as
though the people of the might
tears, which was something
of a life of the princess.

"Ah! you wasted to me the m

In [52]:
checkpoint = 'checkpoints/i200_l500.ckpt'
samp = sample(checkpoint, 1000, lstm_size, len(vocab), prime="Far")
print(samp)


INFO:tensorflow:Restoring parameters from checkpoints/i200_l500.ckpt
Fardidn teons onthe sas ood,, ad an than asisd out hon woun has ther and and with was to ton ho singet on hes winsed thersing. Anded tand wimhe hes, and shed al as on onse ad torithe hh werse she hetere tot hirs hhas had ant her the whed
thand tis tetis himis to tor she an at onle he she ang the thed tho the tan th whe tho chere at th sime son sos and ot and who t he seals, at he whas tald
tho sad ho him sher ond. 
Allis on sithing thor
the ad an thet hang, the to fe the
 her terid te tan the toth tho tan the thas he sithon the and an ot his oudes ond,
sant on ther se at the hand wot and anteresid went he tim the wosen he terind tot oung the whas andinntige fore thing out sor ting
ther wor hat her wess ont he tiste hed ho cist hos anthe sere antother wat th sististh ad worersersend we hhe tas asd tot te he tas and the whed tous tare ad te thar allenting he werise hin theres antho shis whe the wend sorin ther afis haressis sherat, wos ha th masd of on tis he sise sotin an sasdis othe wot th

In [53]:
checkpoint = 'checkpoints/i600_l500.ckpt'
samp = sample(checkpoint, 1000, lstm_size, len(vocab), prime="Far")
print(samp)


INFO:tensorflow:Restoring parameters from checkpoints/i600_l500.ckpt
Farlel to derang on he
souted, and the she that saight he had
as her thought, she went him another, hin him the stard and hissence the stille on that than warked that to a mind, with so the rased
her that sam off the mase, was net the sered
and the stace a consict to she had his said hid to the part trought had.

"Walk, an the said and to his, but and thit starking his, bus shill sontion a secold on her
some,
and who grat was his sithers of the chare, and and his began on his
some to her shis to teen and to
the rimert of
her and said of. She allang
as a corering and
all the plossial of celiter of the paritaly. He couse the ridestion of her
had bres some, the priching with
the soness of that was a complatarest, what the propsent as
intered to stee them as all she alw alloved were her
and, have see the corred the pare him, an what was head heres troughted on ithers the secter at the roond withon the carle wention, and his ald sher her
alone this thilken was
netilige at ancarse of his hestich

In [54]:
checkpoint = 'checkpoints/i1200_l500.ckpt'
samp = sample(checkpoint, 1000, lstm_size, len(vocab), prime="Far")
print(samp)


INFO:tensorflow:Restoring parameters from checkpoints/i1200_l500.ckpt
Farllad in
only anything all, have that she was not to hupbier. And and stidicar fings to him went up a sincly
stranging in officed and allars to be down to the some and seemed on, but took
the
pattering of her shisting towards the mare of his arvertion would not be
the seeved with the still that the pat of that the same wearse of his
house.," said Levin.

"Yes and you say to moment without?". And though anounessing of
her as she saw her house his beal and told a chanted, the
docknow who had not heard his wife, which as he was new houre that to him. "How she heard there
were now and her feeling to be anything, and I would not must seemed, to me, any was the
comparing how," he said, "munt as the cape, is the convaced,"
he always took the there that he went to the
position. The
province of a monting of the stead. She dad her eyes were all attanced the
sented of her freed her him.

"Yes, you've so taking that I don't take it?" she said to his sigut, to all
the plase of all, and he was astion 

In [ ]: