英文

opus-mt-tc-big-en-es

英语(en)翻译成西班牙语(es)的神经机器翻译模型。

该模型是 OPUS-MT project 项目的一部分,旨在让神经机器翻译模型广泛可用和易于访问世界上的许多语言。所有模型最初使用纯 C++ 编写的 Marian NMT 框架进行训练。使用 transformers 库由 huggingface 转换为 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 = [
    "A wasp stung him and he had an allergic reaction.",
    "I love nature."
]

model_name = "pytorch-models/opus-mt-tc-big-en-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:
#     Una avispa lo picó y tuvo una reacción alérgica.
#     Me encanta la naturaleza.

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

from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-es")
print(pipe("A wasp stung him and he had an allergic reaction."))

# expected output: Una avispa lo picó y tuvo una reacción alérgica.

基准测试

langpair testset chr-F BLEU #sent #words
eng-spa tatoeba-test-v2021-08-07 0.73863 57.2 16583 134710
eng-spa flores101-devtest 0.56440 28.5 1012 29199
eng-spa newssyscomb2009 0.58415 31.5 502 12503
eng-spa news-test2008 0.56707 30.1 2051 52586
eng-spa newstest2009 0.57836 30.2 2525 68111
eng-spa newstest2010 0.62357 37.6 2489 65480
eng-spa newstest2011 0.62415 38.9 3003 79476
eng-spa newstest2012 0.63031 39.5 3003 79006
eng-spa newstest2013 0.60354 35.9 3000 70528
eng-spa tico19-test 0.73554 53.0 2100 66563

致谢

这项工作得到 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基础设施。

模型转换信息

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