神经机器翻译模型,用于将中文(zh)翻译为日文(ja)。
该模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型在世界上许多语言中得到广泛应用和普及。所有模型最初都是使用令人惊叹的 Marian NMT 框架进行训练的,该框架是用纯 C++ 编写的高效 NMT 实现。这些模型已经使用 huggingface 的 transformers 库将其转换为 pyTorch。训练数据来自 OPUS ,训练流程使用了 OPUS-MT-train 的程序。模型描述:
该模型可用于翻译和文本生成。
内容警告:读者应该意识到该模型是在各种可能包含令人不安、冒犯并能传播历史和现实刻板印象的公共数据集上进行训练的。
大量研究探讨了语言模型的偏见和公平性问题(详见 Sheng et al. (2021) 和 Bender et al. (2021) 等)。
一个简短示例代码:
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"生日快乐,Muiriel!",
"好凍。"
]
model_name = "pytorch-models/opus-mt-tc-big-zh-ja"
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:
# 誕生日おめでとう、Muiriel!
# 寒い。
您还可以使用 transformers pipelines 使用 OPUS-MT 模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-zh-ja")
print(pipe("生日快乐,Muiriel!"))
# expected output: 誕生日おめでとう、Muiriel!
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| zho-jpn | tatoeba-test-v2021-08-07 | 0.27790 | 24.6 | 2497 | 21956 |
@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 基础设施。