神经机器翻译模型,用于从英语(en)翻译为芬兰语(fi)。
此模型是 OPUS-MT project 的一部分,该项目旨在使神经机器翻译模型在世界上许多语言中广泛可用和可访问。所有模型都是使用纯C++编写的出色的 Marian NMT 框架进行训练的。使用转换器库转换模型为pyTorch,由huggingface提供支持。训练数据取自 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),例如 >>fin<<
简短的示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"Russia is big.",
"Touch wood!"
]
model_name = "pytorch-models/opus-mt-tc-big-en-fi"
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:
# Venäjä on suuri.
# Kosketa puuta!
您还可以使用transformers管道来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-fi")
print(pipe("Russia is big."))
# expected output: Venäjä on suuri.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| eng-fin | tatoeba-test-v2021-08-07 | 0.64352 | 39.3 | 10690 | 65122 |
| eng-fin | flores101-devtest | 0.61334 | 27.6 | 1012 | 18781 |
| eng-fin | newsdev2015 | 0.58367 | 24.2 | 1500 | 23091 |
| eng-fin | newstest2015 | 0.60080 | 26.4 | 1370 | 19735 |
| eng-fin | newstest2016 | 0.61636 | 28.8 | 3000 | 47678 |
| eng-fin | newstest2017 | 0.64381 | 31.3 | 3002 | 45269 |
| eng-fin | newstest2018 | 0.55626 | 19.7 | 3000 | 44836 |
| eng-fin | newstest2019 | 0.58420 | 26.4 | 1997 | 38369 |
| eng-fin | newstestB2016 | 0.57554 | 23.3 | 3000 | 45766 |
| eng-fin | newstestB2017 | 0.60212 | 26.8 | 3002 | 45506 |
该工作得到 European Language Grid 的支持,作为 pilot project 2866 的一部分,受到 FoTran project 的资助,该项目由欧洲研究理事会(ERC)通过欧盟的Horizon 2020研究与创新计划(批准号:771113)和 MeMAD project 的资助,该项目由欧盟Horizon 2020研究与创新计划(批准号:780069)提供。我们还感谢提供的慷慨计算资源和IT基础设施的 CSC -- IT Center for Science ,芬兰。