Sign inSign up

mozilla/translation-service

By mozilla

•Updated over 4 years ago
Archived

https://github.com/mozilla/translation-service

Image
0

1.9K

mozilla/translation-service repository overview

⁠Mozilla Translation Service

HTTP service that uses bergamot-translator⁠ and compressed neural machine translation models⁠ for fast inference on CPU.

⁠Quick start

Install Git LFS (docs⁠). On Linux:

sudo apt-get update
sudo apt-get install -y git-lfs
sudo git lfs install

Donwload models:

git clone https://github.com/mozilla/firefox-translations-models
gzip -d firefox-translations-models/models/prod/*/*

Run service:

docker run --name translation-service -it --rm -v $(pwd)/firefox-translations-models/models/prod:/models -p 8080:8080 -e PORT=8080 mozilla/translation-service:latest

Call HTTP API:

curl --header "Content-Type: application/json" \
      --request POST \
      --data '{"from":"es", "to":"en", "text": "Hola Mundo"}' \
      http://0.0.0.0:8080/v1/translate

See translation result:

> {"result": "Hello World"}

⁠Configuration

The directory that contains unzipped models (esen, ende etc.) should be mounted to /models in Docker container.

Environment variables to set in container:

PORT - service port (default is 8000)

LOGGING_LEVEL - ERROR, WARNING, INFO or DEBUG (default is INFO)

WORKERS - number of bergamot-translator workers (default is 1). 0 - automatically set as the number of available CPUs. It is recommended to minimize workers and scale horizontally with k8s or other orchestrators.

⁠Contributing and issues

Please create issues on Github: https://github.com/mozilla/translation-service⁠

Matrix channel of Firefox Translations project: https://chat.mozilla.org/#/room/#firefoxtranslations:mozilla.org⁠

Tag summary

Content type

Image

Digest

Size

1.2 GB

Last updated

over 4 years ago

docker pull mozilla/translation-service