LibreTranslate setup - TrueConstitution/Translator GitHub Wiki
This page will guide you through setting up the LibreTranslate Translator. LibreTranslate is a free and open source machine translation API, entirely self-hosted. In this mod, you will need to obtain an URL of any working LibreTranslate API to configure the translator. There are a few options:
- Official API. This option costs $29+ a month and is not desirable.
- A Remote Mirror of LibreTranslate. This option would require access to a remote server running a LibreTranslate mirror, preferably with a hardware acceleration GPU. Check out LibreTranslate's docs to explore this option.
- A Local Model. This option is free and simple, but may require some performance from your host computer while playing. You can set this up by following the guide on LibreTranslate's readme.
I will document the way I found the most simple and best performing (for translations) here. Install Docker for Windows or for Linux if you haven't already. If you are on Linux and want hardware acceleration for translations, install GPU Container Toolkits for docker. For NVIDIA-based GPUs, install NVIDIA Container Toolkit. Then, clone the LibreTranslate repository or download the repository source code.
- (Optional) You could enable hardware acceleration if available (not required to install anything extra if all pertinent software/gpu drivers are up-to-date for Windows, have to install GPU container toolkit for Linux). Insert the
--gpus=all
option afterdocker run
in the run script (run.bat
orrun.sh
) to use hardware acceleration. - (Optional) Insert other parameters after
run.bat
/run.sh
, such as--port 80
(For HTTP, default port is 5000),--disable-web-ui
(For disabling the webpage demo and only retaining the API).
Then, run the model using Docker by running the run.bat
or run.sh
file.
If your API, Mirror, or Model requires API keys, you will need an API key to put into the config. Otherwise, you could just leave that blank.
For the URL, insert the fully-qualified HTTP/HTTPS base URL, which is either the public domain/ip and port of the API of choice, OR by default http://localhost:5000
(For locally hosted models).