Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 4, 2026·3 min de lecture

OpenNMT-py — Open Source Neural Machine Translation in PyTorch

OpenNMT-py is a PyTorch-based toolkit for neural machine translation and sequence-to-sequence modeling, supporting Transformer, RNN, and large language model architectures with production-ready training and inference.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
OpenNMT-py
Commande d'installation directe
npx -y tokrepo@latest install 348581fd-7761-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

OpenNMT is an open-source neural machine translation ecosystem started by Harvard NLP and SYSTRAN. The PyTorch version (OpenNMT-py) provides a flexible toolkit for training Transformer and RNN-based sequence-to-sequence models, and has expanded to support large language model fine-tuning and inference. It is used in research and production translation systems worldwide.

What OpenNMT-py Does

  • Train Transformer and RNN encoder-decoder models for translation
  • Fine-tune and serve large language models with LoRA/quantization support
  • Multi-GPU and distributed training with mixed-precision support
  • Beam search, random sampling, and constrained decoding for inference
  • Vocabulary building, data preprocessing, and tokenization pipelines

Architecture Overview

OpenNMT-py uses a modular architecture with configurable encoders, decoders, attention mechanisms, and generators. Configuration is YAML-driven, making experiments reproducible. The training loop supports gradient accumulation, learning rate scheduling, and checkpoint averaging. The inference server supports REST API translation with batching. Recent versions integrate CTranslate2 for optimized production inference.

Self-Hosting & Configuration

  • Install via pip: pip install OpenNMT-py
  • Requires Python 3.8+ and PyTorch
  • All configuration through YAML files for reproducibility
  • Multi-GPU training via PyTorch distributed data parallel
  • Production serving with the built-in REST translation server

Key Features

  • Full Transformer and RNN architectures with copy mechanism and coverage
  • LLM support for fine-tuning and inference with quantization
  • CTranslate2 integration for fast production-grade translation
  • SentencePiece and BPE tokenization built into the pipeline
  • Comprehensive documentation with step-by-step tutorials

Comparison with Similar Tools

  • Hugging Face Transformers — broader model hub; OpenNMT-py is optimized specifically for translation workflows
  • Fairseq — Meta's sequence modeling toolkit; OpenNMT-py has a simpler YAML-driven interface
  • MarianMT — lightweight C++ translation engine; OpenNMT-py offers more flexibility for research
  • Argos Translate — offline translation app; OpenNMT-py is the underlying training and model toolkit

FAQ

Q: Can I use OpenNMT-py for non-translation tasks? A: Yes. OpenNMT-py supports any sequence-to-sequence task including summarization, dialogue, and grammatical error correction.

Q: Does OpenNMT-py support LLM fine-tuning? A: Yes. Recent versions support LoRA adapters and quantization (4-bit, 8-bit) for fine-tuning large language models.

Q: How do I deploy a trained model? A: Use the built-in REST server or export to CTranslate2 format for optimized CPU/GPU inference in production.

Q: What tokenization does OpenNMT-py support? A: SentencePiece (unigram and BPE), BPE with subword-nmt, and character-level tokenization.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires