README.md 1.91 KB
Newer Older
Lukasz Kaiser's avatar
Lukasz Kaiser committed
1
2
3
4
# NeuralGPU
Code for the Neural GPU model as described
in [[http://arxiv.org/abs/1511.08228]].

5
6
7
8
Requirements:
* TensorFlow (see tensorflow.org for how to install)
* Matplotlib for Python (sudo apt-get install python-matplotlib)

9
10
The model can be trained on the following algorithmic tasks:

11
12
13
14
15
16
* `sort` - Sort a symbol list
* `kvsort` - Sort symbol keys in dictionary
* `id` - Return the same symbol list
* `rev` - Reverse a symbol list
* `rev2` - Reverse a symbol dictionary by key
* `incr` - Add one to a symbol value
17
* `add` - Long decimal addition
18
19
20
21
* `left` - First symbol in list
* `right` - Last symbol in list
* `left-shift` - Left shift a symbol list
* `right-shift` - Right shift a symbol list
22
23
* `bmul` - Long binary multiplication
* `mul` - Long decimal multiplication
24
* `dup` - Duplicate a symbol list with padding
25
26
* `badd` - Long binary addition
* `qadd` - Long quaternary addition
27
28
29
30
31
32
33
34
* `search` - Search for symbol key in dictionary

The value range for symbols are defined by the `niclass` and `noclass` flags.
In particular, the values are in the range `min(--niclass, noclass) - 1`.
So if you set `--niclass=33` and `--noclass=33` (the default) then `--task=rev`
will be reversing lists of 32 symbols, and `--task=id` will be identity on a
list of up to 32 symbols.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

To train the model on the reverse task run:

```
python neural_gpu_trainer.py --task=rev
```

While training, interim / checkpoint model parameters will be
written to `/tmp/neural_gpu/`.

Once the amount of error gets down to what you're comfortable
with, hit `Ctrl-C` to stop the training process. The latest
model parameters will be in `/tmp/neural_gpu/neural_gpu.ckpt-<step>`
and used on any subsequent run.

To test a trained model on how well it decodes run:

```
python neural_gpu_trainer.py --task=rev --mode=1
```

To produce an animation of the result run:

```
python neural_gpu_trainer.py --task=rev --mode=1 --animate=True
```
61

62
Maintained by Lukasz Kaiser (lukaszkaiser)