神经机器翻译模型,用于从东斯拉夫语言(zle)翻译成法语(fr)。
该模型是 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",
}
一个简短的示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"Подавай блюдо на тарелке.",
"Операція не може чекати."
]
model_name = "pytorch-models/opus-mt-tc-big-zle-fr"
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:
# Servez le plat dans l'assiette.
# L'opération ne peut pas attendre.
您还可以使用transformers pipelines来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-zle-fr")
print(pipe("Подавай блюдо на тарелке."))
# expected output: Servez le plat dans l'assiette.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| bel-fra | tatoeba-test-v2020-07-28-v2021-08-07 | 0.65415 | 46.4 | 283 | 2005 |
| multi-fra | tatoeba-test-v2020-07-28-v2021-08-07 | 0.68422 | 52.4 | 10000 | 66671 |
| rus-fra | tatoeba-test-v2020-07-28-v2021-08-07 | 0.68699 | 51.8 | 11490 | 80573 |
| ukr-fra | tatoeba-test-v2020-07-28-v2021-08-07 | 0.67887 | 50.7 | 10035 | 63222 |
| rus-fra | newstest2012 | 0.53679 | 25.3 | 3003 | 78011 |
| rus-fra | newstest2013 | 0.56211 | 29.7 | 3000 | 70037 |
该工作得到 European Language Grid 的支持,如 pilot project 2866 所示,以及 FoTran project 的支持,该计划由欧洲研究理事会(ERC)在欧盟的Horizon 2020研究和创新计划(授权协议编号771113)下资助,并且 MeMAD project 得到欧盟Horizon 2020研究和创新计划在授权协议编号780069下的资助。我们还对 CSC -- IT Center for Science 提供的慷慨计算资源和IT基础设施表示感谢。