用于将法语(fr)翻译成东斯拉夫语言(zle)的神经机器翻译模型。
该模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型在世界上许多语言中广泛可用和易于访问。所有模型都是使用 Marian NMT 的惊人框架进行原始训练的,这是一个使用纯C++编写的高效NMT实现。使用transformers库由huggingface将模型转换为pyTorch。训练数据来自 OPUS ,并且训练流水线使用 OPUS-MT-train 的程序。
@inproceedings{tiedemann-thottingal-2020-opus,
title = "{OPUS}-{MT} {--} Building open translation services for the World",
author = {Tiedemann, J{\"o}rg and Thottingal, Santhosh},
booktitle = "Proceedings of the 22nd Annual Conference of the European Association for Machine Translation",
month = nov,
year = "2020",
address = "Lisboa, Portugal",
publisher = "European Association for Machine Translation",
url = "https://aclanthology.org/2020.eamt-1.61",
pages = "479--480",
}
@inproceedings{tiedemann-2020-tatoeba,
title = "The Tatoeba Translation Challenge {--} Realistic Data Sets for Low Resource and Multilingual {MT}",
author = {Tiedemann, J{\"o}rg},
booktitle = "Proceedings of the Fifth Conference on Machine Translation",
month = nov,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2020.wmt-1.139",
pages = "1174--1182",
}
这是一个具有多个目标语言的多语言翻译模型。需要以 >>id<< 的形式提供句子的初始语言标记(id = 有效的目标语言ID),例如 >>bel<<
一个简短的示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
">>rus<< Ils ont acheté un très bon appareil photo.",
">>ukr<< Il s'est soudain mis à pleuvoir."
]
model_name = "pytorch-models/opus-mt-tc-big-fr-zle"
tokenizer = MarianTokenizer.from_pretrained(model_name)
model = MarianMTModel.from_pretrained(model_name)
translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
for t in translated:
print( tokenizer.decode(t, skip_special_tokens=True) )
# expected output:
# Они купили очень хорошую камеру.
# Раптом почався дощ.
您还可以使用transformers管道来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-fr-zle")
print(pipe(">>rus<< Ils ont acheté un très bon appareil photo."))
# expected output: Они купили очень хорошую камеру.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| fra-bel | tatoeba-test-v2021-08-07 | 0.52711 | 31.1 | 283 | 1703 |
| fra-rus | tatoeba-test-v2021-08-07 | 0.66502 | 46.1 | 11490 | 70123 |
| fra-ukr | tatoeba-test-v2021-08-07 | 0.61860 | 39.9 | 10035 | 54372 |
| fra-rus | flores101-devtest | 0.54106 | 25.8 | 1012 | 23295 |
| fra-ukr | flores101-devtest | 0.52733 | 23.1 | 1012 | 22810 |
| fra-rus | newstest2012 | 0.51254 | 23.1 | 3003 | 64790 |
| fra-rus | newstest2013 | 0.52342 | 24.8 | 3000 | 58560 |
这项工作得到 European Language Grid 的支持,作为 pilot project 2866 ,由 FoTran project 资助,该项目由欧洲研究委员会(ERC)在欧洲联盟的Horizon 2020研究和创新计划(授予协议号:771113)以及 MeMAD project 在欧洲联盟的Horizon 2020研究和创新计划下(授予协议号:780069)进行资助。我们还感谢提供给 CSC -- IT Center for Science 的慷慨计算资源和IT基础设施,在芬兰。