Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 4, 2026·3 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
OpenNMT-py
Comando de instalación directa
npx -y tokrepo@latest install 348581fd-7761-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con 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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados