神经机器翻译模型,用于将立陶宛语(lt)翻译为英语(en)。
该模型是 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 = [
"Katė sedėjo ant kėdės.",
"Jukiko mėgsta bulves."
]
model_name = "pytorch-models/opus-mt-tc-big-lt-en"
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:
# The cat sat on a chair.
# Yukiko likes potatoes.
您还可以使用transformers pipelines来使用OPUS-MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-lt-en")
print(pipe("Katė sedėjo ant kėdės."))
# expected output: The cat sat on a chair.
| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| lit-eng | tatoeba-test-v2021-08-07 | 0.74881 | 61.6 | 2528 | 17855 |
| lit-eng | flores101-devtest | 0.60662 | 34.3 | 1012 | 24721 |
| lit-eng | newsdev2019 | 0.59995 | 32.9 | 2000 | 49312 |
| lit-eng | newstest2019 | 0.61742 | 32.3 | 1000 | 25878 |
这项工作得到 European Language Grid 和 pilot project 2866 的支持,由 FoTran project 提供资金,这是欧洲研究委员会(ERC)根据欧洲联盟的Horizon 2020研究和创新计划(授权协议编号:771113)和 MeMAD project 提供的资金支持,这是欧洲联盟的Horizon 2020研究和创新计划根据授权协议编号780069提供的资金支持。我们还感谢芬兰的 CSC -- IT Center for Science 提供的慷慨计算资源和IT基础设施。