用于从阿拉伯语(ar)翻译到英语(en)的神经机器翻译模型。
该模型是OPUS-MT 项目的一部分,该项目旨在为世界上多种语言提供广泛可用且易于获取的神经机器翻译模型。所有模型最初均使用出色的 Marian NMT 框架进行训练,这是一个用纯 C++ 编写的高效 NMT 实现。这些模型已通过 huggingface 的 transformers 库转换为 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-ar-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:
# Just follow your heart.
# Wayne Rahi Dosh?您也可以通过 transformers 流水线使用 OPUS-MT 模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-ar-en")
print(pipe("اتبع قلبك فحسب."))
# expected output: Just follow your heart.| 语言对 | 测试集 | 字符F值 | BLEU值 | 句子数 | 单词数 |
|---|---|---|---|---|---|
| ara-eng | tatoeba-test-v2021-08-07 | 0.63477 | 47.3 | 10305 | 76975 |
| ara-eng | flores101-devtest | 0.66987 | 42.6 | 1012 | 24721 |
| ara-eng | tico19-test | 0.68521 | 44.4 | 2100 | 56323 |
本研究得到了欧洲语言网格(试点项目 2866,参见https://live.european-language-grid.eu/catalogue/#/resource/projects/2866)、FoTran 项目(由欧洲研究理事会(ERC)在欧盟“地平线 2020”研究与创新计划资助,资助协议编号 771113)以及MeMAD 项目(由欧盟“地平线 2020”研究与创新计划资助,资助协议编号 780069)的支持。我们同样感谢芬兰CSC——科学 IT 中心提供的慷慨计算资源和 IT 基础设施。