Giter VIP home page Giter VIP logo

stopes's Introduction

stopes

stopes: A library for preparing data for machine translation research

As part of the FAIR No Language Left Behind (NLLB) (Paper, Website, Blog) project to drive inclusion through machine translation, a large amount of data was processed to create training data. We provide the libraries and tools we used to:

  1. create clean monolingual data from web data
  2. mine bitext
  3. easily write scalable pipelines for processing data for machine translation

Full documentation on https://facebookresearch.github.io/stopes

Examples

checkout the demo directory for an example usage with the WMT22 Shared Task: Large-Scale Machine Translation Evaluation for African Languages data.

Requirements

stopes relies on:

  • submitit to schedule jobs when ran on clusters
  • hydra-core version >= 1.2.0 for configuration
  • fairseq to use LASER encoders
  • PyTorch version >= 1.5.0
  • Python version >= 3.8

Installing stopes

stopes uses flit to manage its setup, you will need a recent version of pip for the install to work. We recommend that you first upgrade pip: python -m pip install --upgrade pip

The mining pipeline relies on fairseq to run LASER encoders, because of competing dependency version, you'll have to first install fairseq with pip separately:

pip install fairseq==0.12.1

You can then install stopes with pip:

git clone https://github.com/facebookresearch/stopes.git
cd stopes
pip install -e '.[dev,mono,mining,mining-gpu]'

You can choose what to install. If you are only interested in mining, you do not need to install dev, and mono. If you are interested in the distillation pipeline, you will need to install at least mono. mining will install the cpu version of the dependencies for mining, if you want to do mining on gpu, and your system is compatible, you can install [mining,mining-gpu].

Currently fairseq and stopes require different version of hydra, so pip might output some warnings, do not worry about them, we want hydra>=1.1.

If you plan to train a lot of NMT model you will also want to setup apex to get a faster training.

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" ./

How stopes works

stopes is made of a few different parts:

  1. core provides a library to write readable piplines
  2. modules provides a set of modules using the core library and implementing common steps in our mining and evaluation pipelines
  3. pipelines provides pipeline implementation for the data pipelines we use in NLLB:
  • monolingual to preprocess and clean single language data
  • bitext to run the "global mining" pipeline and extract aligned sentences from two monolingual datasets. (inspired by CCMatric)
  • distilation to run our sequence-level knowledge distillation pipeline which trains a small student model from a pre-trained large teacher model (approach based on https://arxiv.org/abs/1606.07947)
  1. eval provides a set of evaluation tools, including ALTI+ and BLASER for text-free speech translation evaluation.
  2. demo contains applications of stopes, including a quickstart demo that you can run at home of mining as well as a example usage of ALTI+ for toxicity and hallucination analysis.

Full documentation: see https://facebookresearch.github.io/stopes or the websites/docs folder.

Contributing

See the CONTRIBUTING file for how to help out.

Contributors

(in alphabetical order)

Citation

If you use stopes in your work, please cite:

@inproceedings{andrews-etal-2022-stopes,
    title = "stopes - Modular Machine Translation Pipelines",
    author = "Pierre Andrews, Guillaume Wenzek, Kevin Heffernan, Onur Çelebi, Anna Sun, Ammar Kamran, Yingzhe Guo, Alexandre Mourachko, Holger Schwenk, Angela Fan",
    booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
    month = dec,
    year = "2022",
    publisher = "Association for Computational Linguistics",
}

Some of the tools in stopes, like BLASER and ALTI have their own publications, please see in the specific readme for the correct citation to use for these specific tools.

stopes was originally built as part of the NLLB project, if you use any models/datasets/artifacts published in NLLB, please cite :

@article{nllb2022,
  title={No Language Left Behind: Scaling Human-Centered Machine Translation},
  author={{NLLB Team} and Costa-jussà, Marta R. and Cross, James and Çelebi, Onur and Elbayad, Maha and Heafield, Kenneth and Heffernan, Kevin and Kalbassi, Elahe and Lam, Janice and Licht, Daniel and Maillard, Jean and Sun, Anna and Wang, Skyler and Wenzek, Guillaume and Youngblood, Al and Akula, Bapi and Barrault, Loic and Mejia-Gonzalez, Gabriel and Hansanti, Prangthip and Hoffman, John and Jarrett, Semarley and Sadagopan, Kaushik Ram and Rowe, Dirk and Spruit, Shannon and Tran, Chau and Andrews, Pierre and Ayan, Necip Fazil and Bhosale, Shruti and Edunov, Sergey and Fan, Angela and Gao, Cynthia and Goswami, Vedanuj and Guzmán, Francisco and Koehn, Philipp and Mourachko, Alexandre and Ropers, Christophe and Saleem, Safiyyah and Schwenk, Holger and Wang, Jeff},
  year={2022}
}

License

stopes is MIT licensed, as found in the LICENSE file.

stopes's People

Contributors

alexmourachko avatar avidale avatar donglixp avatar gwenzek avatar heffernankevin avatar martacostajussa avatar mortimerp9 avatar oneraghavan avatar trangvu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.