Lingvo
Clone or download
lingvo-bot and Copybara-Service Split py_binary into py_binary and py_library to avoid having py_bina…
…ry in deps.

PiperOrigin-RevId: 230008151
Latest commit 7a7ed2c Jan 18, 2019

README.md

Lingvo

What is it?

Lingvo is a framework for building neural networks in Tensorflow, particularly sequence models.

A list of publications using Lingvo can be found here.

Quick start

Docker

The docker files in the docker directory provide a blueprint of how to install and run the software in multiple configurations.

Installation

The prerequisites are:

  • a TensorFlow installation (for now tf-nightly is required),
  • a C++ compiler (only g++ 4.8 is officially supported),
  • the bazel build system, and
  • the protobuf package.

Running the MNIST image model

Preparing the input data

mkdir -p /tmp/mnist
bazel run -c opt //lingvo/tools:keras2ckpt -- --dataset=mnist --out=/tmp/mnist/mnist

You will get the following files in /tmp/mnist:

  • mnist.data-00000-of-00001: 53MB.
  • mnist.index: 241 bytes.

Running the model

To run the trainer in single-machine mode, use

bazel build -c opt //lingvo:trainer
bazel-bin/lingvo/trainer --run_locally=cpu --mode=sync --model=image.mnist.LeNet5 --logdir=/tmp/mnist/log --logtostderr

After a few seconds, the training accuracy should reach 85% at step 100, as seen in the following line.

INFO:tensorflow:step:   100 accuracy:0.85546875 log_pplx:0.46025506 loss:0.46025506 num_preds:256 num_samples_in_batch:256

The artifacts will be produced in /tmp/mnist/log/control:

  • params.txt: hyper-parameters.
  • model_analysis.txt: model sizes for each layer.
  • train.pbtxt: the training tf.GraphDef.
  • events.*: a tensorboard events file.

In the /tmp/mnist/log/train directory, one will obtain:

  • ckpt-*: the checkpoint files.
  • checkpoint: a text file containing information about the checkpoint files.

Running the machine translation model

To run a more elaborate model, you'll need a cluster with GPUs. Please refer to lingvo/tasks/mt/README.md for more information.

Current models

Automatic Speech Recogition

Image

Language Modelling

Machine Translation

[1]: Listen, Attend and Spell. William Chan, Navdeep Jaitly, Quoc V. Le, and Oriol Vinyals. ICASSP 2016.

[2]: End-to-end Continuous Speech Recognition using Attention-based Recurrent NN: First Results. Jan Chorowski, Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. arXiv 2014.

[3]: Gradient-based learning applied to document recognition. Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. IEEE 1998.

[4]: Exploring the Limits of Language Modeling. Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. arXiv, 2016.

[5]: The Best of Both Worlds: Combining Recent Advances in Neural Machine Translation. Mia X. Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George Foster, Llion Jones, Mike Schuster, Noam Shazeer, Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Zhifeng Chen, Yonghui Wu, and Macduff Hughes. ACL 2018.

Citation

Please cite this paper when referencing Lingvo.

Coming soon.