Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Go to file
Spencer Poff 5c241c8c5f support streaming iterator
Summary:
For tasks that involve streaming data directly from an API, we need a simpler epoch iterator.

Also included in this change is support for initializing a dictionary with an arbitrary list of special symbols.

Reviewed By: myleott

Differential Revision: D16110603

fbshipit-source-id: be6d9f680292dec1512614871f9269c95ac84861
2019-07-03 19:39:28 -07:00
docs v0.7.1: fix PyPI setup and tests 2019-06-20 06:28:37 -07:00
examples Better explain the inference argument format of multilingual translation 2019-06-19 19:45:13 -07:00
fairseq support streaming iterator 2019-07-03 19:39:28 -07:00
fairseq_cli Add fairseq to PyPI (#495) 2019-02-08 22:03:29 -08:00
scripts wav2vec model (#654) 2019-06-19 19:24:48 -07:00
tests Fix resuming training when using --memory-efficient-fp16 2019-06-23 14:19:16 -07:00
.gitignore Fix option in docs (#735) 2019-05-12 16:37:59 -07:00
CODE_OF_CONDUCT.md Adding Code of Conduct file (#603) 2019-03-28 22:36:49 -07:00
CONTRIBUTING.md Architecture settings and readme updates 2017-09-15 11:40:28 -07:00
eval_lm.py Merge internal changes (#654) 2019-04-29 19:50:58 -07:00
fairseq_logo.png Fixes (#442) 2019-01-14 08:58:51 -08:00
fairseq.gif Initial commit 2017-09-14 17:22:43 -07:00
generate.py Update generate.py (#831) 2019-06-27 16:12:44 -07:00
hubconf.py Add more torch.hub deps 2019-06-12 10:32:25 -07:00
interactive.py More generator features for demo (#791) 2019-06-10 10:58:59 -07:00
LICENSE Initial commit 2017-09-14 17:22:43 -07:00
PATENTS Initial commit 2017-09-14 17:22:43 -07:00
preprocess.py Enhanced MMapIndexedDataset: less memory, higher speed (#816) 2019-06-19 20:26:01 -07:00
README.md wav2vec model (#654) 2019-06-19 19:24:48 -07:00
score.py Add --sentence-bleu option to score.py 2019-05-28 11:52:54 -07:00
setup.py v0.7.1: fix PyPI setup and tests 2019-06-20 06:28:37 -07:00
train.py add --max-tokens-valid option for validation 2019-07-01 18:24:14 -07:00

Introduction

Fairseq(-py) is a sequence modeling toolkit that allows researchers and developers to train custom models for translation, summarization, language modeling and other text generation tasks. It provides reference implementations of various sequence-to-sequence models, including:

Fairseq features:

  • multi-GPU (distributed) training on one machine or across multiple machines
  • fast generation on both CPU and GPU with multiple search algorithms implemented:
  • large mini-batch training even on a single GPU via delayed updates
  • mixed precision training (trains faster with less GPU memory on NVIDIA tensor cores)
  • extensible: easily register new models, criterions, tasks, optimizers and learning rate schedulers

We also provide pre-trained models for several benchmark translation and language modeling datasets.

Model

Requirements and Installation

  • PyTorch version >= 1.0.0
  • Python version >= 3.5
  • For training new models, you'll also need an NVIDIA GPU and NCCL

Please follow the instructions here to install PyTorch: https://github.com/pytorch/pytorch#installation.

If you use Docker make sure to increase the shared memory size either with --ipc=host or --shm-size as command line options to nvidia-docker run.

After PyTorch is installed, you can install fairseq with pip:

pip install fairseq

Installing from source

To install fairseq from source and develop locally:

git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable .

Improved training speed

Training speed can be further improved by installing NVIDIA's apex library with the --cuda_ext option. fairseq will automatically switch to the faster modules provided by apex.

Getting Started

The full documentation contains instructions for getting started, training new models and extending fairseq with new model types and tasks.

Pre-trained models and examples

We provide pre-trained models and pre-processed, binarized test sets for several tasks listed below, as well as example training and evaluation commands.

We also have more detailed READMEs to reproduce results from specific papers:

Join the fairseq community

License

fairseq(-py) is BSD-licensed. The license applies to the pre-trained models as well. We also provide an additional patent grant.

Citation

Please cite as:

@inproceedings{ott2019fairseq,
  title = {fairseq: A Fast, Extensible Toolkit for Sequence Modeling},
  author = {Myle Ott and Sergey Edunov and Alexei Baevski and Angela Fan and Sam Gross and Nathan Ng and David Grangier and Michael Auli},
  booktitle = {Proceedings of NAACL-HLT 2019: Demonstrations},
  year = {2019},
}