神经机器翻译模型,用于将英语(en)翻译为立陶宛语(lt)。
该模型是 OPUS-MT project 的一部分,旨在使神经机器翻译模型在全球范围内广泛可用和可访问。所有模型最初使用的是 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 = [
"A cat was sitting on the chair.",
"Yukiko likes potatoes."
]
model_name = "pytorch-models/opus-mt-tc-big-en-lt"
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:
# Katė sėdėjo ant kėdės.
# Jukiko mėgsta bulves.
您还可以使用transformers pipelines来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-lt")
print(pipe("A cat was sitting on the chair."))
# expected output: Katė sėdėjo ant kėdės.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| eng-lit | tatoeba-test-v2021-08-07 | 0.67434 | 39.5 | 2528 | 14942 |
| eng-lit | flores101-devtest | 0.59593 | 28.0 | 1012 | 20695 |
| eng-lit | newsdev2019 | 0.58444 | 26.6 | 2000 | 39627 |
| eng-lit | newstest2019 | 0.51559 | 17.5 | 998 | 19711 |
该工作得到了 European Language Grid 的支持,作为 pilot project 2866 ,得到了 FoTran project 的支持,该项目由欧洲研究理事会(ERC)根据欧洲联盟的Horizon 2020研究和创新计划(协议编号为771113)以及根据欧洲联盟的Horizon 2020研究和创新计划(协议编号为780069)的支持。我们还感谢 CSC -- IT Center for Science 所提供的慷慨计算资源和IT基础设施,芬兰。