This release is a pre-release and may not be stable for production use.
OVOS No Language Left Behind Plugin (CTranslate2)
This is a language plugin for NLLB-200, a translation model from Meta AI.
Overview
NLLB200Translator translates text between languages with the NLLB-200 models. It plugs into the OVOS framework and uses CTranslate2 to run translation fast and efficiently.
Model Options
The table below lists the available models for the NLLB-200 translator.
| Model Name | Source | Description |
|---|---|---|
| flores200_sacrebleu_tokenizer_spm | CTranslate2 | Tokenizer model |
| nllb-200_600M_int8 | CTranslate2 | 600M parameter model, int8 quantized |
| nllb-200_1.2B_int8 | CTranslate2 | 1.2B parameter model, int8 quantized |
| nllb-200-3.3B-int8 | CTranslate2 | 3.3B parameter model, int8 quantized |
| nllb-200-distilled-1.3B-ct2-int8 | HuggingFace Hub: OpenNMT/nllb-200-distilled-1.3B-ct2-int8 | 1.3B distilled model, int8 quantized |
| nllb-200-3.3B-ct2-int8 | HuggingFace Hub: OpenNMT/nllb-200-3.3B-ct2-int8 | 3.3B model, int8 quantized |
Install
Install the plugin with pip:
pip install ovos-translate-plugin-nllb
Usage
OVOS Integration
Use the plugin inside OVOS to translate utterances and text on demand. Add this configuration to one of the configuration files, for example ~/.config/mycroft/mycroft.conf:
{
"language": {
"translation_module": "ovos-translate-plugin-nllb",
"ovos-translate-plugin-nllb": {
"model": "nllb-200_600M_int8"
}
}
}
Python Script
This example shows how to use NLLB200Translator in a Python script.
from ovos_translate_plugin_nllb import NLLB200Translator
src = "es"
tgt = "en-us"
tx = NLLB200Translator(config={"model": "nllb-200_600M_int8"})
utts = ["Hola Mundo"]
print("Translations:", tx.translate(utts, tgt, src))
utts = "hello world"
print("Translations:", tx.translate(utts, src, tgt))
Advanced Configuration
HuggingFace Integration
To use a model hosted on the HuggingFace Hub, set the model parameter to the HuggingFace model ID. NLLB200Translator downloads and loads the model from HuggingFace.
Additional Parameters
beam_size: the beam size used for translation. A larger value trades speed for translation quality.device: the device to run on, eithercpuorcuda(GPU).
from ovos_translate_plugin_nllb import NLLB200Translator
tx = NLLB200Translator(config={
"model": "nllb-200_600M_int8",
"beam_size": 5,
"device": "cuda"
})
Using CUDA/GPU
Set NLLB200Translator to the cuda device to use GPU acceleration. This can speed up translation for large batches or long texts.
Prerequisites
You need a CUDA-compatible GPU and the CUDA drivers for your system. See the CUDA Installation Guide for details.
Example
This example configures and runs NLLB200Translator with CUDA.
from ovos_translate_plugin_nllb import NLLB200Translator
if __name__ == "__main__":
src = "es"
tgt = "en-us"
tx = NLLB200Translator(config={
"model": "nllb-200-3.3B-int8",
"beam_size": 5,
"device": "cuda"
})
utts = ["Hola Mundo"]
print("Translations:", tx.translate(utts, tgt, src))
utts = "hello world"
print("Translations:", tx.translate(utts, src, tgt))
Related Projects
- OpenVoiceOS/ovos-translate-server-plugin - a translation plugin that calls a remote translate server
- OpenVoiceOS/ovos-translate-server - a server that exposes translation plugins over HTTP
- OpenVoiceOS/ovos-bidirectional-translation-plugin - a plugin that chains two translators for bidirectional translation
License
This project is licensed under the Apache License 2.0.
Metadata
Release files for ovos-translate-plugin-nllb 0.0.4a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ovos_translate_plugin_nllb-0.0.4a1.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ovos_translate_plugin_nllb-0.0.4a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.9 kB
Release files / ovos_translate_plugin_nllb-0.0.4a1.tar.gz
| Download URL | ovos_translate_plugin_nllb-0.0.4a1.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abeaf508f6ae7af391f1cdf890cc34e6e89f952463fb089709e3d58b50423834
|
|
BLAKE2b-256 checksum How to use checksums |
50bde89287fdbd16b1493fff6ed30fcd8a833e2c73dd70fda69e93c321bde99b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ovos_translate_plugin_nllb-0.0.4a1-py3-none-any.whl
| Download URL | ovos_translate_plugin_nllb-0.0.4a1-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dc6670a57ac3a981eef41193b640560d40be1fc999df6ebc9437c96bdf2255c
|
|
BLAKE2b-256 checksum How to use checksums |
7e71765f0728bca74ccca5d7238831e8310092d27ef0ee6c93bb390a65ccea29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for ovos-translate-plugin-nllb 0.0.4a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.