Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Go to file
Myle Ott f812e52956 Rename data.transforms -> data.encoders
Summary: Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/747

Differential Revision: D16403464

Pulled By: myleott

fbshipit-source-id: ee3b4184f129a02be833c7bdc00685978b4de883
2019-07-21 03:52:05 -07:00
docs Improve interactive generation (support --tokenizer and --bpe) 2019-07-19 06:45:18 -07:00
examples Improve interactive generation (support --tokenizer and --bpe) 2019-07-19 06:45:18 -07:00
fairseq Rename data.transforms -> data.encoders 2019-07-21 03:52:05 -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 Nucleus (top-P) sampling (#710) 2019-07-17 06:21:33 -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 Small bug fix for generation when batch_size is small 2019-07-17 05:32:36 -07:00
hubconf.py Add more torch.hub deps 2019-06-12 10:32:25 -07:00
interactive.py Rename data.transforms -> data.encoders 2019-07-21 03:52:05 -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 -> v0.7.2 (#891) 2019-07-19 06:33:40 -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},
}