神经机器翻译模型,用于将土耳其语(tr)翻译成英语(en)。
此模型是 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 = [
    "Allahsızlığı Yayma Kürsüsü başkanıydı.",
    "Tom'a ne olduğunu öğrenin."
]
model_name = "pytorch-models/opus-mt-tc-big-tr-en"
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:
#     He was the president of the Curse of Spreading Godlessness.
#     Find out what happened to Tom.
 您还可以使用 transformers pipelines 使用 OPUS-MT 模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-tr-en")
print(pipe("Allahsızlığı Yayma Kürsüsü başkanıydı."))
# expected output: He was the president of the Curse of Spreading Godlessness.
 | langpair | testset | chr-F | BLEU | #sent | #words | 
|---|---|---|---|---|---|
| tur-eng | tatoeba-test-v2021-08-07 | 0.71895 | 57.6 | 13907 | 109231 | 
| tur-eng | flores101-devtest | 0.64152 | 37.6 | 1012 | 24721 | 
| tur-eng | newsdev2016 | 0.58658 | 32.1 | 1001 | 21988 | 
| tur-eng | newstest2016 | 0.56960 | 29.3 | 3000 | 66175 | 
| tur-eng | newstest2017 | 0.57455 | 29.7 | 3007 | 67703 | 
| tur-eng | newstest2018 | 0.58488 | 30.7 | 3000 | 68725 | 
该工作得到 European Language Grid 的支持,作为 pilot project 2866 ,以及 FoTran project 的支持,该项目由欧洲研究委员会(ERC)在欧洲联盟的Horizon 2020研究和创新计划(授权协议编号:771113)下资助,以及 MeMAD project 的支持,该项目在欧洲联盟的Horizon 2020研究和创新计划下获得资助,授权协议编号:780069。我们还对芬兰的 CSC -- IT Center for Science 提供的慷慨计算资源和IT基础设施表示感谢。