I also attach my results.
Data params
Sequence Length
sequence_length = 20  # of words in a sequence
Batch Size
batch_size = 128
data loader - do not change
train_loader = batch_data(int_text, sequence_length, batch_size)
Training parameters
Number of Epochs
num_epochs = 20
Learning Rate
learning_rate = 0.001
Model parameters
Vocab size
vocab_size = len(vocab_to_int)
Output size
output_size = vocab_size
Embedding Dimension
embedding_dim = 200
Hidden Dimension
hidden_dim = 400
Number of RNN Layers
n_layers = 2
Show stats for every n number of batches
show_every_n_batches = 1
create model and move to gpu if available
rnn = RNN(vocab_size, output_size, embedding_dim, hidden_dim, n_layers, dropout=0.5)
if train_on_gpu:
rnn.cuda()
defining loss and optimization functions for training
optimizer = torch.optim.Adam(rnn.parameters(), lr=learning_rate)
criterion = nn.CrossEntropyLoss()
training the model
trained_rnn = train_rnn(rnn, batch_size, optimizer, criterion, num_epochs, show_every_n_batches)
saving the trained model
helper.save_model(’./save/trained_rnn’, trained_rnn)
print(‘Model Trained and Saved’)
Training for 20 epoch(s)…
Epoch:    1/20    Loss: 9.181344604492187
Epoch:    2/20    Loss: 8.977545619010925
Epoch:    3/20    Loss: 8.97732071876526
Epoch:    4/20    Loss: 8.97721266746521
Epoch:    5/20    Loss: 8.977132678031921
Epoch:    6/20    Loss: 8.977069520950318
Epoch:    7/20    Loss: 8.97701997756958
Epoch:    8/20    Loss: 8.976981210708619
Epoch:    9/20    Loss: 8.97695345878601
Epoch:   10/20    Loss: 8.976929020881652
Epoch:   11/20    Loss: 8.976907062530518
Epoch:   12/20    Loss: 8.976887893676757
Epoch:   13/20    Loss: 8.976875948905946
Epoch:   14/20    Loss: 8.976863694190978
Epoch:   15/20    Loss: 8.976851677894592
Epoch:   16/20    Loss: 8.97684371471405
Epoch:   17/20    Loss: 8.97683494091034
Epoch:   18/20    Loss: 8.976829504966735
Epoch:   19/20    Loss: 8.976822710037231
Epoch:   20/20    Loss: 8.976818060874939