This is the repo that hosts the code for Mozilla's translation service
Перейти к файлу
Jason Chuang 9077098d2f
Updated Intel MKL library PubKey in Dockerfile. (#28)
2024-02-12 14:09:09 -08:00
.circleci Add tests to Ci (#21) 2022-06-20 16:15:10 -07:00
3rd_party Fix failing on some models (#20) 2022-06-20 17:37:47 -07:00
scripts Add support of Ukrainian models (#22) 2022-06-22 08:50:33 -07:00
src Add support of Ukrainian models (#22) 2022-06-22 08:50:33 -07:00
tests Add support of Ukrainian models (#22) 2022-06-22 08:50:33 -07:00
.gitignore Tests and small improvements (#10) 2021-12-08 11:26:48 -08:00
.gitmodules Initial server (#1) 2021-12-03 21:03:37 -08:00
CMakeLists.txt Initial server (#1) 2021-12-03 21:03:37 -08:00
Dockerfile Updated Intel MKL library PubKey in Dockerfile. (#28) 2024-02-12 14:09:09 -08:00
LICENSE Initial commit 2021-12-02 15:20:59 -08:00
Makefile Fix failing on some models (#20) 2022-06-20 17:37:47 -07:00
README.md Add dockerhub link 2022-02-08 16:02:41 -08:00

README.md

Translation service

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

Running locally

  1. Install Git LFS https://git-lfs.github.com/
  2. git clone this repo
  3. make setup-models
  4. make build-docker
  5. make run
  6. make call

Calling the service

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

Service configuration

Directory that contains 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 number of available CPUs. It is recommended to minimize workers and scale horizontaly with k8s means.

Testing

make python-env - install pip packages

make test - to run integration API tests

make load-test - to run a stress test (requires more models to download that unit tests)