Skip to content
Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Python Cuda Other
Branch: master
Clone or download

Latest commit

Duc Le and facebook-github-bot Enforce max limit of buffer size
Reviewed By: jay-mahadeokar

Differential Revision: D21804332

fbshipit-source-id: 51997455560a6b67f66d1401ef7095d4a1de4027
Latest commit 1e40a48 May 31, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github fix Windows build (#1007) Jan 24, 2020
docs add vq-wav2vec (#1029) Mar 1, 2020
examples Miscellaneous fixes (#2193) May 28, 2020
fairseq Enforce max limit of buffer size May 30, 2020
fairseq_cli Support multi-GPU validation in fairseq-validate (#2162) May 27, 2020
scripts support manifold in average_checkpoint.py Mar 30, 2020
tests Avoid NaN in speech_recognition with input having only 1 spec… (#1864) May 27, 2020
.gitignore REFACTOR: NAT Implementation (#925) Dec 4, 2019
.gitmodules adding model parallel multihead attention module (#1088) Mar 18, 2020
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md (#1759) Mar 4, 2020
CONTRIBUTING.md Relicense fairseq under MIT license (#786) Jul 30, 2019
LICENSE Relicense fairseq under MIT license (#786) Jul 30, 2019
README.md Several small fixes (incl. set default --data-buffer-size=10) (#2163) May 26, 2020
eval_lm.py Fix binaries in root dir (#995) Jan 17, 2020
fairseq.gif Initial commit Sep 15, 2017
fairseq_logo.png Fixes (#442) Jan 14, 2019
generate.py Fix binaries in root dir (#995) Jan 17, 2020
hubconf.py Build Cython components when loading hub (#1386) Nov 18, 2019
interactive.py Fix binaries in root dir (#995) Jan 17, 2020
preprocess.py Fix binaries in root dir (#995) Jan 17, 2020
pyproject.toml fetch pyproject.toml for building cython codes without pre-installati… Feb 16, 2020
score.py Fix binaries in root dir (#995) Jan 17, 2020
setup.py Fix binaries in root dir (#995) Jan 17, 2020
train.py Fix binaries in root dir (#995) Jan 17, 2020
validate.py Fix binaries in root dir (#995) Jan 17, 2020

README.md



MIT License Latest Release Build Status Documentation Status


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. We provide reference implementations of various sequence modeling papers:

List of implemented papers

What's New:

Previous updates

Features:

  • multi-GPU training on one machine or across multiple machines (data and model parallel)
  • 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 translation and language modeling with a convenient torch.hub interface:

en2de = torch.hub.load('pytorch/fairseq', 'transformer.wmt19.en-de.single_model')
en2de.translate('Hello world', beam=5)
# 'Hallo Welt'

See the PyTorch Hub tutorials for translation and RoBERTa for more examples.

Requirements and Installation

  • PyTorch version >= 1.4.0
  • Python version >= 3.6
  • For training new models, you'll also need an NVIDIA GPU and NCCL
  • To install fairseq and develop locally:
git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./

# on MacOS:
# CFLAGS="-stdlib=libc++" pip install --editable ./
  • For faster training install NVIDIA's apex library:
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" \
  --global-option="--deprecated_fused_adam" --global-option="--xentropy" \
  --global-option="--fast_multihead_attn" ./
  • For large datasets install PyArrow: pip install pyarrow
  • 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.

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 MIT-licensed. The license applies to the pre-trained models as well.

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},
}
You can’t perform that action at this time.