Machine Learning

Machine Learning in Linux: LibreTranslate is Self-hosted Machine Translation

Our Machine Learning in Linux series focuses on apps that make it easy to experiment with machine learning.

We recently explored Argos Translate, state of the art neural machine translation software. That software provides a Python library, command-line interface, and a GUI.

LibreTranslate is a machine translation API which is entirely self-hosted. This software lets you use open source machine translation in your projects. It uses Argos Translate for its translation engine.

Installation

We tested LibreTranslate with the Arch distro. As we recommended in our review of Argos Translate, use a virtual environment to install LibreTranslate. We’ll use conda, but you may prefer to run the software with Docker.

Create our conda environment with the command:

$ conda create --name libretranslate

Activate that environment with the command:

$ conda activate libretranslate

Install the software with all the dependencies with the command:

$ pip install libretranslate

This command downloads the Python packages to ~/.local/lib/python3.11/site-packages and takes up 4.4GB of disk space.

You’ll see output such as this if everything proceeds normally.

Successfully installed APScheduler-3.9.1 Babel-2.12.1 Flask-2.2.2 Flask-Babel-3.1.0 Flask-Limiter-2.6.3 Flask-Session-0.4.0 LTpycld2-0.42 Werkzeug-2.2.2 argos-translate-files-1.1.1 argostranslate-1.8.0 beautifulsoup4-4.9.3 cachelib-0.10.2 charset-normalizer-2.1.1 cmake-3.26.4 commonmark-0.9.1 ctranslate2-2.24.0 expiringdict-1.2.2 flask-swagger-0.2.14 flask-swagger-ui-4.11.1 importlib-resources-5.12.0 libretranslate-1.3.11 limits-3.5.0 morfessor-2.0.6 mpmath-1.3.0 networkx-3.1 numpy-1.25.0 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 polib-1.1.1 prometheus-client-0.15.0 redis-4.3.4 requests-2.28.1 rich-12.6.0 sentencepiece-0.1.96 stanza-1.1.1 sympy-1.12 torch-2.0.1 translatehtml-1.5.2 triton-2.0.0 tzlocal-5.0.1 waitress-2.1.2

The first time you run libretranslate, the software will download the language models if they are not already installed (if you’ve previously installed Argos Translate).

Downloading in progress for language models

The language models are stored in ~/.local/share/argos-translate/packages and consume about 7GB of disk space.

Next page: Page 2 – In Operation and Summary

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our FAQ before making a comment.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments