英文

opus-mt-tc-big-en-hu

神经机器翻译模型,用于将英语(en)翻译成匈牙利语(hu)。

此模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型在世界上许多语言中广泛可用和可访问。所有模型最初都是使用 Marian NMT 的出色框架进行训练的, 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 = [
    "I wish I hadn't seen such a horrible film.",
    "She's at school."
]

model_name = "pytorch-models/opus-mt-tc-big-en-hu"
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:
#     Bárcsak ne láttam volna ilyen szörnyű filmet.
#     Iskolában van.

您还可以使用transformers pipelines来使用OPUS-MT模型,例如:

from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-hu")
print(pipe("I wish I hadn't seen such a horrible film."))

# expected output: Bárcsak ne láttam volna ilyen szörnyű filmet.

基准测试

langpair testset chr-F BLEU #sent #words
eng-hun tatoeba-test-v2021-08-07 0.62096 38.7 13037 79562
eng-hun flores101-devtest 0.60159 29.6 1012 22183
eng-hun newssyscomb2009 0.51918 20.6 502 9733
eng-hun newstest2009 0.50973 20.3 2525 54965

致谢

该工作得到 European Language Grid pilot project 2866 的支持,由 FoTran project 资助,由欧洲研究理事会(ERC)在欧洲联盟的Horizon 2020研究和创新计划(授予协议号771113)下资助,以及由 MeMAD project 以欧洲联盟的Horizon 2020研究和创新计划的资助协议号780069。我们还感谢 CSC -- IT Center for Science 提供的慷慨计算资源和IT基础设施,芬兰。

模型转换信息

  • transformers版本:4.16.2
  • OPUS-MT git哈希值:3405783
  • 转换时间:2022年4月13日17:21:20 EEST
  • 转换机器:LM0-400-22516.local