Download this Shakespeare dataset (from Andrej Karpathy's char-rnn) and save as shakespeare.txt
The Jupyter Notebook version of the tutorial describes the model and steps in detail.
Run train.py
with a filename to train and save the network:
> python train.py shakespeare.txt
Training for 2000 epochs...
(10 minutes later)
Saved as shakespeare.pt
After training the model will be saved as [filename].pt
— now run generate.py
with that filename to generate some new text:
> python generate.py shakespeare.pt --prime_str "Where"
Where, you, and if to our with his drid's
Weasteria nobrand this by then.
AUTENES:
It his zersit at he
Usage: train.py [filename] [options]
Options:
--n_epochs Number of epochs to train
--print_every Log learning rate at this interval
--hidden_size Hidden size of GRU
--n_layers Number of GRU layers
--learning_rate Learning rate
--chunk_len Length of chunks to train on at a time
Usage: generate.py [filename] [options]
Options:
-p, --prime_str String to prime generation with
-l, --predict_len Length of prediction
-t, --temperature Temperature (higher is more chaotic)