Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Go to file
zhiqiang d0577ba7a5 Fix option in docs (#735)
Summary:
`--output-format` -> `--dataset-impl` in Tutorial: Classifying Names with a Character-Level RNN
Pull Request resolved: https://github.com/pytorch/fairseq/pull/735

Differential Revision: D15314625

Pulled By: myleott

fbshipit-source-id: 65b8efd1a367ca754e5b9dca088aefbc648864dd
2019-05-12 16:37:59 -07:00
docs Fix option in docs (#735) 2019-05-12 16:37:59 -07:00
examples Merge internal changes (#654) 2019-04-29 19:50:58 -07:00
fairseq convert logits to fp32 for calculating loss in masked_lm_loss criterion 2019-05-11 09:15:18 -07:00
fairseq_cli Add fairseq to PyPI (#495) 2019-02-08 22:03:29 -08:00
scripts Add scripts for working with txt files containing document boundaries 2019-05-12 16:31:57 -07:00
tests expose arguments for bias_kv and zero_attn for masked_lm 2019-05-08 17:48:29 -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 Merge internal changes (#654) 2019-04-29 19:50:58 -07:00
interactive.py Cleanup LM + Flake8 2019-05-08 09:00:37 -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 Memory-Mapped IndexedDataset implementation (#589) 2019-05-07 07:13:52 -07:00
README.md Update comments and citations 2019-04-29 08:01:16 -07:00
score.py Move string line encoding logic from tokenizer to Dictionary (unified diff). (#541) 2019-02-28 09:19:12 -08:00
setup.py Update setup.py 2019-03-15 21:30:41 -07:00
train.py Cleanup LM + Flake8 2019-05-08 09:00:37 -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
  • fast half-precision floating point (FP16) training
  • 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.6
  • 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},
}