Skip to content

jerrylasama/mtlapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTLApi

XUnity.AutoTranslator compatible REST Service powered by HuggingFace Transformers

Getting Started

Install poetry: https://python-poetry.org/docs/

  1. Install required dependencies
poetry install
  1. Change the model name at mtlapi/constants/language.py and add language mapping as required at mtlapi/constants/language.py

  2. Start the server

poetry run dev
  1. Edit the AutoTranslatorConfig.ini for XUnity.AutoTranslator (usually at config/AutoTranslatorConfig.ini)
[Service]
Endpoint=CustomTranslate

[Custom]
Url=http://localhost:8000/translate
EnableShortDelay=False
DisableSpamChecks=False

Language Mapping

You can configure the language mapping in the mtlapi/constants/language.py file, but only if the model requires it. The dict key comes from the XUnity.AutoTranslator Config, which the service parsed from the request sent by AutoTranslator based on the AutoTranslatorConfig.ini configuration:

[General]
Language=en
FromLanguage=zh

and the value is based on the language mapped into the model. By default the value is mapped to Meta AI's NLLB 200. MarianMT based models do not require this for inference so you can just ignore it completely.

About

XUnity.AutoTranslator compatible REST Service powered by HuggingFace Transformers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages