Skip to main content

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 Warning: the latest pip (about 23.3) seems to no longer support the way the dependencies are declared in fasttext and maybe other packages without pyproject.toml. To bypass the associated problems, consider installing the wheel package.

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.2

You can then install stopes with pip:

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

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

Speech package installing

Some speech packages like the MMS Text-to-Speech(TTS) require additional library installation, see here for more details.

In addition, the UST library has its own set of extra dependencies.

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 CCMatrix)
  • 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

You can find the list of the main contributors in the NLLB and Seamless Communication papers.

(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}
}

If you use SeamlessM4T in your work or any models/datasets/artifacts published in SeamlessM4T, please cite :

@article{seamlessm4t2023,
  title={SeamlessM4T—Massively Multilingual \& Multimodal Machine Translation},
  author={{Seamless Communication}, Lo\"{i}c Barrault, Yu-An Chung, Mariano Cora Meglioli, David Dale, Ning Dong, Paul-Ambroise Duquenne, Hady Elsahar, Hongyu Gong, Kevin Heffernan, John Hoffman, Christopher Klaiber, Pengwei Li, Daniel Licht, Jean Maillard, Alice Rakotoarison, Kaushik Ram Sadagopan, Guillaume Wenzek, Ethan Ye,  Bapi Akula, Peng-Jen Chen, Naji El Hachem, Brian Ellis, Gabriel Mejia Gonzalez, Justin Haaheim, Prangthip Hansanti, Russ Howes, Bernie Huang, Min-Jae Hwang, Hirofumi Inaguma, Somya Jain, Elahe Kalbassi, Amanda Kallet, Ilia Kulikov, Janice Lam, Daniel Li, Xutai Ma, Ruslan Mavlyutov, Benjamin Peloquin, Mohamed Ramadan, Abinesh Ramakrishnan, Anna Sun, Kevin Tran, Tuan Tran, Igor Tufanov, Vish Vogeti, Carleigh Wood, Yilin Yang, Bokai Yu, Pierre Andrews, Can Balioglu, Marta R. Costa-juss\`{a} \footnotemark[3], Onur \,{C}elebi,Maha Elbayad,Cynthia Gao, Francisco Guzm\'an, Justine Kao, Ann Lee, Alexandre Mourachko, Juan Pino, Sravya Popuri, Christophe Ropers, Safiyyah Saleem, Holger Schwenk, Paden Tomasello, Changhan Wang, Jeff Wang, Skyler Wang},
  journal={ArXiv},
  year={2023}
}

License

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

When using speech mining with the SONAR models, beware that this code and models are released under CC-BY-NC 4.0.

Metadata

Release files for stopes 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stopes 2.2.1
File Size Uploaded
stopes-2.2.1.tar.gz 3.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for stopes 2.2.1
File Interpreter ABI Platform
stopes-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.9 MB

Release files / stopes-2.2.1.tar.gz

Download URL stopes-2.2.1.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
0c8b039c98555a33c140d2173e9b0a1fc26318f7ac5102161b8822fc87869159
BLAKE2b-256 checksum
How to use checksums
b4f6fa510377300ea915ee2b89db55978eb363ce1fb488ac356325a0339ca0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / stopes-2.2.1-py3-none-any.whl

Download URL stopes-2.2.1-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
edf258d46f4471459c7164b1d78d432ae350447d751c78b3b1cf76742857421f
BLAKE2b-256 checksum
How to use checksums
6a8a9a24f7f4a7f26e883094738a156d7ce64e5c229d109ec838343da131d440
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page