Home

Awesome

byteNet-tensorflow

Join the chat at https://gitter.im/byteNet-tensorflow/Lobby

This is a tensorflow implementation of the byte-net model from DeepMind's paper Neural Machine Translation in Linear Time.

From the abstract

The ByteNet decoder attains state-of-the-art performance on character-level language modeling and outperforms the previous best results obtained with recurrent neural networks. The ByteNet also achieves a performance on raw character-level machine translation that approaches that of the best neural translation models that run in quadratic time. The implicit structure learnt by the ByteNet mirrors the expected alignments between the sequences.

ByteNet Encoder-Decoder Model:

Model architecture

Image Source - Neural Machine Translation in Linear Time paper

The model applies dilated 1d convolutions on the sequential data, layer by layer to obain the source encoding. The decoder then applies masked 1d convolutions on the target sequence (conditioned by the encoder output) to obtain the next character in the target sequence.The character generation model is just the byteNet decoder, while the machine translation model is the combined encoder and decoder.

Implementation Notes

  1. The character generation model is defined in ByteNet/generator.py and the translation model is defined in ByteNet/translator.py. ByteNet/ops.py contains the bytenet residual block, dilated conv1d and layer normalization.
  2. The model can be configured by editing model_config.py.
  3. Number of residual channels 512 (Configurable in model_config.py).

Requirements

Datasets

Training

Create the following directories Data/tb_summaries/translator_model, Data/tb_summaries/generator_model, Data/Models/generation_model, Data/Models/translation_model.

Generating Samples

Sample Generations

ANTONIO:
What say you to this part of this to thee?

KING PHILIP:
What say these faith, madam?

First Citizen:
The king of England, the will of the state,
That thou dost speak to me, and the thing that shall
In this the son of this devil to the storm,
That thou dost speak to thee to the world,
That thou dost see the bear that was the foot,

Translation Results to be updated

TODO

References