用于将英语(en)翻译为韩语(ko)的神经机器翻译模型。
该模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型广泛可用和可访问,服务于世界上许多语言。所有模型最初都是使用 Marian NMT 提供的惊人框架进行训练的,这是一个用纯C++编写的高效NMT实现。使用 transformers library by huggingface 将模型转换为pyTorch。训练数据来自 OPUS ,训练流程使用 OPUS-MT-train 的程序。模型描述:
这是一个多语言翻译模型,具有多个目标语言。形式上需要一个句子初始的语言标记,如 >>id<<(id = 有效的目标语言ID),例如 >><<
该模型可用于翻译和文本生成。
内容警告:读者应意识到该模型是基于各种可能包含令人不安、冒犯和传播历史和现实刻板印象内容的公共数据集进行训练的。
大量研究探讨了语言模型的偏见和公平性问题(参见,例如, Sheng et al. (2021) 和 Bender et al. (2021) )。
一个简短的示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"2, 4, 6 etc. are even numbers.",
"Yes."
]
model_name = "pytorch-models/opus-mt-tc-big-en-ko"
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:
# 2, 4, 6 등은 짝수입니다.
# 그래
您还可以使用 transformers pipelines 来使用 OPUS-MT 模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-ko")
print(pipe("2, 4, 6 etc. are even numbers."))
# expected output: 2, 4, 6 등은 짝수입니다.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|
@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研究和创新计划(授权协议编号 No 771113)下资助,以及 MeMAD project ,该项目在欧洲联盟的Horizon 2020研究和创新计划(授权协议编号 No 780069)下资助。我们还感谢 CSC -- IT Center for Science 提供的慷慨计算资源和IT基础设施,芬兰。