用于将德语(de)翻译成西班牙语(es)的神经机器翻译模型。
此模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型在世界上的许多语言中得到广泛的可用性和可访问性。所有模型最初都是使用惊人的 Marian NMT 框架进行训练的,该框架是用纯C++编写的高效NMT实现。这些模型使用了 transformers 库由 huggingface 转换为 pyTorch 格式。训练数据取自 OPUS ,训练流程使用了 OPUS-MT-train 的过程。模型描述:
该模型可用于翻译和文本生成。
内容警告:读者应注意,该模型基于可能包含令人不安、冒犯以及可能传播历史和当前刻板印象的各种公共数据集进行训练。
较多研究已经探讨了语言模型的偏见和公平性问题(参见,例如, Sheng et al. (2021) 和 Bender et al. (2021) )。
简短的示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"Ich verstehe nicht, worüber ihr redet.",
"Die Vögel singen in den Bäumen."
]
model_name = "pytorch-models/opus-mt-tc-big-de-es"
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:
# No entiendo de qué están hablando.
# Los pájaros cantan en los árboles.
也可以使用transformers的pipelines来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-de-es")
print(pipe("Ich verstehe nicht, worüber ihr redet."))
# expected output: No entiendo de qué están hablando.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| deu-spa | tatoeba-test-v2021-08-07 | 0.69105 | 50.8 | 10521 | 82570 |
| deu-spa | flores101-devtest | 0.53208 | 24.9 | 1012 | 29199 |
| deu-spa | newssyscomb2009 | 0.55547 | 28.3 | 502 | 12503 |
| deu-spa | news-test2008 | 0.54400 | 26.6 | 2051 | 52586 |
| deu-spa | newstest2009 | 0.53934 | 25.9 | 2525 | 68111 |
| deu-spa | newstest2010 | 0.60102 | 33.8 | 2489 | 65480 |
| deu-spa | newstest2011 | 0.57133 | 31.3 | 3003 | 79476 |
| deu-spa | newstest2012 | 0.58119 | 32.6 | 3003 | 79006 |
| deu-spa | newstest2013 | 0.57559 | 32.4 | 3000 | 70528 |
@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",
}
该工作得到了 European Language Grid 的支持,作为 pilot project 2866 的一部分,以及 FoTran project 的支持,该项目由欧洲研究委员会(ERC)在欧洲联盟的Horizon 2020研究和创新计划(授权协议号为771113)下资助,以及 MeMAD project 的支持,该项目由欧洲联盟的Horizon 2020研究和创新计划在授权协议号为780069的支持下开展。我们还感谢 CSC -- IT Center for Science ,芬兰提供的慷慨计算资源和IT基础设施。