Path: blob/master/examples/generative/ipynb/lstm_character_level_text_generation.ipynb
3508 views
Kernel: Python 3
Character-level text generation with LSTM
Author: fchollet
Date created: 2015/06/15
Last modified: 2020/04/30
Description: Generate text from Nietzsche's writings with a character-level LSTM.
Introduction
This example demonstrates how to use a LSTM model to generate text character-by-character.
At least 20 epochs are required before the generated text starts sounding locally coherent.
It is recommended to run this script on GPU, as recurrent networks are quite computationally intensive.
If you try this script on new data, make sure your corpus has at least ~100k characters. ~1M is better.
Setup
In [0]:
Prepare the data
In [0]:
Build the model: a single LSTM layer
In [0]:
Prepare the text sampling function
In [0]:
Train the model
In [0]: