
# T5 English, Russian and Chinese multilingual machine translation

This model represents a conventional T5 transformer in multitasking mode for translation into the required language, precisely configured for machine translation for pairs: ru-zh, zh-ru, en-zh, zh-en, en-ru, ru-en.

The model can perform direct translation between any pair of Russian, Chinese or English languages. For translation into the target language, the target language identifier is specified as a prefix 'translate to <lang>:'. In this case, the source language may not be specified, in addition, the source text may be multilingual.

Example translate Russian to Chinese

```python
from transformers import T5ForConditionalGeneration, T5Tokenizer

model_name = 'utrobinmv/t5_translate_en_ru_zh_small_1024'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)

prefix = 'translate to zh: '
src_text = prefix + "Цель разработки — предоставить пользователям личного синхронного переводчика."

# translate Russian to Chinese
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#开发的目的就是向用户提供个性化的同步翻译。
```



and Example translate Chinese to Russian

```python
from transformers import T5ForConditionalGeneration, T5Tokenizer

model_name = 'utrobinmv/t5_translate_en_ru_zh_small_1024'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)

prefix = 'translate to ru: '
src_text = prefix + "开发的目的就是向用户提供个性化的同步翻译。"

# translate Russian to Chinese
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#Цель разработки - предоставить персонализированный синхронный перевод для пользователей.
```



##  



## Languages covered

Russian (ru_RU), Chinese (zh_CN), English (en_US)

{"language": ["ru", "zh", "en"], "license": "apache-2.0", "tags": ["translation"], "datasets": ["ccmatrix"], "metrics": ["sacrebleu"], "widget": [{"example_title": "translate zh-ru", "text": "translate to ru: \u5f00\u53d1\u7684\u76ee\u7684\u662f\u4e3a\u7528\u6237\u63d0\u4f9b\u4e2a\u4eba\u540c\u6b65\u7ffb\u8bd1\u3002\n"}, {"example_title": "translate ru-en", "text": "translate to en: \u0426\u0435\u043b\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u2014 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430.\n"}, {"example_title": "translate en-ru", "text": "translate to ru: The purpose of the development is to provide users with a personal synchronized interpreter.\n"}, {"example_title": "translate en-zh", "text": "translate to zh: The purpose of the development is to provide users with a personal synchronized interpreter.\n"}, {"example_title": "translate zh-en", "text": "translate to en: \u5f00\u53d1\u7684\u76ee\u7684\u662f\u4e3a\u7528\u6237\u63d0\u4f9b\u4e2a\u4eba\u540c\u6b65\u89e3\u91ca\u5668\u3002\n"}, {"example_title": "translate ru-zh", "text": "translate to zh: \u0426\u0435\u043b\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u2014 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430."}]}
transformers safetensors t5 text2text-generation translation ru zh en dataset:ccmatrix license:apache-2.0 autotrain_compatible endpoints_compatible has_space text-generation-inference region:us