README.md 834 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Shakespeare character LSTM model

This is an implemention of a simple character LSTM used to generate text.

## Instructions

First download the source data:

```
wget https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt
```

Note that files other than shakepeare.txt can also be used to train the model to generater other text.

Then train the model:

17
```python
18
19
python3 shakespeare_main.py --training_data shakespeare.txt \
    --model_dir /tmp/shakespeare
20
```
21
22
23
24
25

This will place model checkpoints in `/tmp/shakespeare`, so that we can use them to make predictions.

Then generate predictions:

26
```python
27
28
29
30
python3 shakespeare_main.py --training_data shakespeare.txt \
    --model_dir /tmp/shakespeare --notrain --predict_context=ROMEO:
```

31
Change `--predict_context` and `--predict_length` to suit your needs.