Opennmt Py

Open Source Neural Machine Translation and (Large) Language Models in PyTorch
Alternatives To Opennmt Py
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Pytorch Cyclegan And Pix2pix20,036
4 months ago493otherPython
Image-to-Image Translation in PyTorch
14 days ago279Jupyter Notebook
State-of-the-Art Deep Learning scripts organized by models - easy to train and deploy with reproducible accuracy and performance on enterprise-grade infrastructure.
Attention Is All You Need Pytorch7,813
a month ago72mitPython
A PyTorch implementation of the Transformer model in "Attention is All You Need".
Opennmt Py6,267282 days ago31June 22, 202328mitPython
Open Source Neural Machine Translation and (Large) Language Models in PyTorch
Practical Pytorch4,272
2 years ago91mitJupyter Notebook
Go to - this repo is deprecated and no longer maintained
2 years ago6mitPython
人像卡通化探索项目 (photo-to-cartoon translation project)
Contrastive Unpaired Translation1,955
25 days ago94otherPython
Contrastive unpaired image-to-image translation, faster and lighter training than cyclegan (ECCV 2020, in PyTorch)
223 days ago85June 12, 20172apache-2.0Python
Sequence-to-sequence framework with a focus on Neural Machine Translation based on PyTorch
Nlp Tutorial836
3 years ago6mitJupyter Notebook
A list of NLP(Natural Language Processing) tutorials
3 months ago16otherPython
AttentionGAN for Unpaired Image-to-Image Translation & Multi-Domain Image-to-Image Translation
Alternatives To Opennmt Py
Select To Compare

Alternative Project Comparisons

OpenNMT-py: Open-Source Neural Machine Translation and (Large) Language Models

Build Status Documentation Gitter Forum

OpenNMT-py is the PyTorch version of the OpenNMT project, an open-source (MIT) neural machine translation (and beyond!) framework. It is designed to be research friendly to try out new ideas in translation, language modeling, summarization, and many other NLP tasks. Some companies have proven the code to be production ready.

We love contributions! Please look at issues marked with the contributions welcome tag.

Before raising an issue, make sure you read the requirements and the Full Documentation examples.

Unless there is a bug, please use the Forum or Gitter to ask questions.

For beginners:

There is a step-by-step and explained tuto (Thanks to Yasmin Moslem): Tutorial

Please try to read and/or follow before raising newbies issues.

Otherwise you can just have a look at the Quickstart steps


  • Special note on Pytorch v2: up to v2.0.1 dynamic shapes are not handled properly, hence torch.compile() will not work with OpenNMT-py. We have tested nightly (in May) and it works with a small gain. Next version will be 2.1
  • LLM support with converters for: Llama, OpenLlama, Redpajama, MPT-7B, Falcon.
  • Support for 8bit and 4bit quantization along with LoRA adapters, with or without checkpointing.
  • You can finetune 7B and 13B models on a single RTX 24GB with 4-bit quantization.
  • Inference can be forced in 4/8bit using the same layer quantization as in finetuning.
  • Once your model is finetuned you can run inference either with OpenNMT-py or faster with CTranslate2.
  • MMLU evaluation script, see results here

For all usecases including NMT, you can now use Multiquery instead of Multihead attention (faster at training and inference) and remove biases from all Linear (QKV as well as FeedForward modules).

If you used previous versions of OpenNMT-py, you can check the Changelog or the Breaking Changes


  • How to replicate Vicuna with a 7B or 13B llama (or Open llama, MPT-7B, Redpajama) Language Model: Tuto Vicuna
  • How to finetune NLLB-200 with your dataset: Tuto Finetune NLLB-200
  • How to create a simple OpenNMT-py REST Server: Tuto REST
  • How to create a simple Web Interface: Tuto Streamlit
  • Replicate the WMT17 en-de experiment: WMT17 ENDE


OpenNMT-py requires:

  • Python >= 3.8
  • PyTorch >= 2.0 <2.1

Install OpenNMT-py from pip:

pip install OpenNMT-py

or from the sources:

git clone
cd OpenNMT-py
pip install -e .

Note: if you encounter a MemoryError during installation, try to use pip with --no-cache-dir.

(Optional) Some advanced features (e.g. working pretrained models or specific transforms) require extra packages, you can install them with:

pip install -r requirements.opt.txt

Special note on flash attention support:

When using regular position_encoding=True or Rotary with max_relative_positions=-1 OpenNMT-py will try to use an optimized dot-product path.

if you want to use flash attention 2 then you need to manually install it first:

pip install flash-attn --no-build-isolation

if flash attention 2 is not installed, then we will use F.scaled_dot_product_attention from pytorch 2.x

When using max_relative_positions > 0 or Alibi max_relative_positions=-2 OpenNMT-py will use its legacy code for matrix multiplications.

flash attention is a bit faster and saves some GPU memory.

Documentation & FAQs

Full HTML Documentation



OpenNMT-py is run as a collaborative open-source project. Project was incubated by Systran and Harvard NLP in 2016 in Lua and ported to Pytorch in 2017.

Current maintainers (since 2018):

François Hernandez and Ubiqus Team. Vincent Nguyen (Seedfall)


If you are using OpenNMT-py for academic work, please cite the initial system demonstration paper published in ACL 2017:

    title = "{O}pen{NMT}: Open-Source Toolkit for Neural Machine Translation",
    author = "Klein, Guillaume  and
      Kim, Yoon  and
      Deng, Yuntian  and
      Senellart, Jean  and
      Rush, Alexander",
    booktitle = "Proceedings of {ACL} 2017, System Demonstrations",
    month = jul,
    year = "2017",
    address = "Vancouver, Canada",
    publisher = "Association for Computational Linguistics",
    url = "",
    pages = "67--72",
Popular Pytorch Projects
Popular Translation Projects
Popular Machine Learning Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Deep Learning
Language Model
Machine Translation
Neural Machine Translation