argosopentech/argos-translate

Open-source offline translation library written in Python

Argos Translate – Offline machine‑translation library

What it is – A Python package that lets you run neural‑machine‑translation models locally, without needing an internet connection. It wraps the OpenNMT /CTranslate2 inference engine and provides a simple API, a command‑line tool, and (via a separate repo) a desktop GUI.

Key capabilities

  • Plug‑in language models – Translation models are distributed as ".argosmodel" zip files. The argospm-index repository lists dozens of pre‑trained models (Arabic, Chinese, French, Swahili, …) and the package manager (argospm) can download and install them.
  • Pivot translation – If a direct model for a language pair is missing, Argos Translate can automatically route the text through an intermediate language (e.g., es → en → fr) using the models you have installed.
  • GPU support – Setting the environment variable ARGOS_DEVICE_TYPE=cuda (or auto) passes the device choice to the underlying CTranslate2 engine, enabling CUDA acceleration.
  • Multiple front‑ends
    • Python library (argostranslate.translate.translate)
    • CLI (argos-translate and argospm commands)
    • Desktop GUI (in the separate argos-translate-gui repo)
    • Web/API – the LibreTranslate service is built on top of Argos Translate and exposes a REST endpoint.
  • Extensions – Helper libraries for translating HTML (translate-html) and whole files (argos-translate-files).

Installation

# Core library
pip install argostranslate

# Optional GUI
pip install argostranslategui

You can also clone the repo and install in a virtual environment with pip install -e ..

Quick example (Python)

import argostranslate.package, argostranslate.translate

from_code, to_code = "en", "es"
# fetch latest model list and install the needed pair
argostranslate.package.update_package_index()
pkg = next(p for p in argostranslate.package.get_available_packages()
           if p.from_code == from_code and p.to_code == to_code)
argostranslate.package.install_from_path(pkg.download())

print(argostranslate.translate.translate("Hello World", from_code, to_code))
# → ¡Hola Mundo!

Command‑line usage

argospm update                     # refresh model index
argospm install translate-en_de    # install a specific model
argos-translate --from en --to de "Hello World!"
# → Hallo Welt!

Ecosystem & related projects

  • LibreTranslate – a public web API and demo site that runs Argos Translate under the hood.
  • argos‑train – scripts for training your own models compatible with Argos Translate.
  • MetalTranslate – a C++ wrapper around the same translation engine.
  • Language‑model bindings for many languages (Python, Rust, Go, Java) are listed in the README.

License – Dual‑licensed under MIT or CC0, allowing both permissive commercial use and public‑domain dedication.

Who might use it – Developers needing on‑device translation (privacy‑sensitive apps, edge devices, offline tools), researchers experimenting with OpenNMT models, or anyone who wants a free, self‑hosted alternative to cloud translation services.

Related

  • Project
  • Project
  • Project
  • Project
  • Project