用于从阿拉伯语(ara)翻译成意大利语类(itc)的神经机器翻译模型。
这个模型是 OPUS-MT project 的一部分,它致力于使神经机器翻译模型在世界上的许多语言中得到广泛的应用和使用。所有模型最初都是使用令人惊叹的框架 Marian NMT 进行训练的,这是一个用纯C++编写的高效的NMT实现。这些模型已经使用huggingface的transformers库将其转换为pyTorch。训练数据来自 OPUS ,并且训练流程使用了 OPUS-MT-train 的过程。模型描述:
这是一个多语言翻译模型,具有多个目标语言。需要以表格形式提供句子的初始语言令牌,例如 >>id<< (id = 有效的目标语言ID),例如 >>fra<<
此模型可用于翻译和文本生成。
内容警告:读者应注意,该模型是基于可能包含令人不安、冒犯并传递历史和当前刻板印象的各种公共数据集进行训练的。
大量研究已经探讨了语言模型的偏见和公正性问题(例如,参见 Sheng et al. (2021) 和 Bender et al. (2021) )。
示例代码:
from transformers import MarianMTModel, MarianTokenizer src_text = [ ">>lat_Latn<< إيش إسمك؟", ">>por<< اليونان جميلة." ] model_name = "pytorch-models/opus-mt-tc-big-ar-itc" 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: # Iulia: Tu nombre es? # A Grécia é linda.
您还可以使用transformers pipelines来使用OPUS-MT模型,例如:
from transformers import pipeline pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-ar-itc") print(pipe(">>lat_Latn<< إيش إسمك؟")) # expected output: Iulia: Tu nombre es?
langpair | testset | chr-F | BLEU | #sent | #words |
---|---|---|---|---|---|
ara-fra | tatoeba-test-v2021-08-07 | 0.57876 | 41.5 | 1569 | 11066 |
ara-ita | tatoeba-test-v2021-08-07 | 0.66888 | 46.5 | 235 | 1495 |
ara-spa | tatoeba-test-v2021-08-07 | 0.64686 | 47.2 | 1511 | 9708 |
ara-cat | flores101-devtest | 0.55670 | 28.7 | 1012 | 27304 |
ara-fra | flores101-devtest | 0.59715 | 33.4 | 1012 | 28343 |
ara-glg | flores101-devtest | 0.51898 | 23.5 | 1012 | 26582 |
ara-ita | flores101-devtest | 0.52523 | 22.3 | 1012 | 27306 |
ara-por | flores101-devtest | 0.58260 | 31.6 | 1012 | 26519 |
ara-ron | flores101-devtest | 0.51425 | 22.4 | 1012 | 26799 |
ara-spa | flores101-devtest | 0.50203 | 21.8 | 1012 | 29199 |
@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 提供,通过欧洲研究委员会(ERC)在欧洲联盟的“2020年地平线2020研究和创新计划”(授予协议编号771113)和 MeMAD project 提供,通过欧洲联盟的“2020年地平线2020研究和创新计划”(授予协议编号780069)提供。我们还对芬兰 CSC -- IT Center for Science 的慷慨提供的计算资源和IT基础设施表示感谢。