模型简介
模型特点
模型能力
使用案例
🚀 opus-mt-tc-big-de-es
该模型是一个用于将德语(de)翻译成西班牙语(es)的神经机器翻译模型。它属于OPUS - MT项目的一部分,旨在让神经机器翻译模型在全球多种语言中广泛可用。
🚀 快速开始
代码示例
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"Ich verstehe nicht, worüber ihr redet.",
"Die Vögel singen in den Bäumen."
]
model_name = "pytorch-models/opus-mt-tc-big-de-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:
# No entiendo de qué están hablando.
# Los pájaros cantan en los árboles.
你也可以使用transformers管道来使用OPUS - MT模型,例如:
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-de-es")
print(pipe("Ich verstehe nicht, worüber ihr redet."))
# expected output: No entiendo de qué están hablando.
✨ 主要特性
- 该模型是用于从德语(de)到西班牙语(es)的神经机器翻译模型。
- 属于[OPUS - MT项目](https://github.com/Helsinki - NLP/Opus - MT),旨在让神经机器翻译模型广泛可用。
- 最初使用[Marian NMT](https://marian - nmt.github.io/)框架进行训练,后使用huggingface的transformers库转换为pyTorch。
- 训练数据来自OPUS,训练管道采用[OPUS - MT - train](https://github.com/Helsinki - NLP/Opus - MT - train)的流程。
📦 安装指南
文档未提供具体安装步骤,故跳过此章节。
💻 使用示例
基础用法
from transformers import MarianMTModel, MarianTokenizer
src_text = [
"Ich verstehe nicht, worüber ihr redet.",
"Die Vögel singen in den Bäumen."
]
model_name = "pytorch-models/opus-mt-tc-big-de-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:
# No entiendo de qué están hablando.
# Los pájaros cantan en los árboles.
高级用法
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-de-es")
print(pipe("Ich verstehe nicht, worüber ihr redet."))
# expected output: No entiendo de qué están hablando.
📚 详细文档
模型详情
- 开发者:赫尔辛基大学语言技术研究小组
- 模型类型:翻译(transformer - big)
- 发布时间:2022 - 07 - 26
- 许可证:CC - BY - 4.0
- 语言:
- 源语言:deu
- 目标语言:spa
- 语言对:deu - spa
- 有效目标语言标签:无
- 原始模型:[opusTCv20210807_transformer - big_2022 - 07 - 26.zip](https://object.pouta.csc.fi/Tatoeba - MT - models/deu - spa/opusTCv20210807_transformer - big_2022 - 07 - 26.zip)
- 更多信息资源:
- [OPUS - MT - train GitHub仓库](https://github.com/Helsinki - NLP/OPUS - MT - train)
- 此语言对已发布模型的更多信息:[OPUS - MT deu - spa README](https://github.com/Helsinki - NLP/Tatoeba - Challenge/tree/master/models/deu - spa/README.md)
- transformers库中MarianNMT模型的更多信息
- [Tatoeba翻译挑战](https://github.com/Helsinki - NLP/Tatoeba - Challenge/)
用途
该模型可用于翻译和文本到文本的生成。
风险、限制和偏差
⚠️ 重要提示
读者应注意,该模型是在各种公共数据集上训练的,这些数据集可能包含令人不安、冒犯性的内容,并可能传播历史和当前的刻板印象。
大量研究已经探讨了语言模型的偏差和公平性问题(例如,参见[Sheng等人(2021)](https://aclanthology.org/2021.acl - long.330.pdf)和Bender等人(2021))。
训练
- 数据:opusTCv20210807 ([来源](https://github.com/Helsinki - NLP/Tatoeba - Challenge))
- 预处理:SentencePiece (spm32k,spm32k)
- 模型类型:transformer - big
- 原始MarianNMT模型:[opusTCv20210807_transformer - big_2022 - 07 - 26.zip](https://object.pouta.csc.fi/Tatoeba - MT - models/deu - spa/opusTCv20210807_transformer - big_2022 - 07 - 26.zip)
- 训练脚本:[GitHub仓库](https://github.com/Helsinki - NLP/OPUS - MT - train)
评估
- 测试集翻译:[opusTCv20210807_transformer - big_2022 - 07 - 26.test.txt](https://object.pouta.csc.fi/Tatoeba - MT - models/deu - spa/opusTCv20210807_transformer - big_2022 - 07 - 26.test.txt)
- 测试集得分:[opusTCv20210807_transformer - big_2022 - 07 - 26.eval.txt](https://object.pouta.csc.fi/Tatoeba - MT - models/deu - spa/opusTCv20210807_transformer - big_2022 - 07 - 26.eval.txt)
- 基准测试结果:benchmark_results.txt
- 基准测试输出:benchmark_translations.zip
属性 | 详情 |
---|---|
模型类型 | 翻译(transformer - big) |
训练数据 | opusTCv20210807 |
语言对 | 测试集 | chr - F | BLEU | 句子数量 | 单词数量 |
---|---|---|---|---|---|
deu - spa | tatoeba - test - v2021 - 08 - 07 | 0.69105 | 50.8 | 10521 | 82570 |
deu - spa | flores101 - devtest | 0.53208 | 24.9 | 1012 | 29199 |
deu - spa | newssyscomb2009 | 0.55547 | 28.3 | 502 | 12503 |
deu - spa | news - test2008 | 0.54400 | 26.6 | 2051 | 52586 |
deu - spa | newstest2009 | 0.53934 | 25.9 | 2525 | 68111 |
deu - spa | newstest2010 | 0.60102 | 33.8 | 2489 | 65480 |
deu - spa | newstest2011 | 0.57133 | 31.3 | 3003 | 79476 |
deu - spa | newstest2012 | 0.58119 | 32.6 | 3003 | 79006 |
deu - spa | newstest2013 | 0.57559 | 32.4 | 3000 | 70528 |
引用信息
如果你使用此模型,请引用以下出版物:[OPUS - MT – Building open translation services for the World](https://aclanthology.org/2020.eamt - 1.61/) 和 [The Tatoeba Translation Challenge – Realistic Data Sets for Low Resource and Multilingual MT](https://aclanthology.org/2020.wmt - 1.139/)。
@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",
}
致谢
这项工作得到了[欧洲语言网格](https://www.european - language - grid.eu/)的支持,作为[试点项目2866](https://live.european - language - grid.eu/catalogue/#/resource/projects/2866);还得到了[FoTran项目](https://www.helsinki.fi/en/researchgroups/natural - language - understanding - with - cross - lingual - grounding)的资助,该项目由欧洲研究理事会(ERC)在欧盟的“地平线2020”研究和创新计划(资助协议编号771113)下资助;以及MeMAD项目的资助,该项目由欧盟的“地平线2020”研究和创新计划在资助协议编号780069下资助。我们也感谢CSC -- 芬兰科学信息技术中心提供的慷慨计算资源和IT基础设施。
模型转换信息
- transformers版本:4.16.2
- OPUS - MT git哈希值:8b9f0b0
- 转换时间:2022年8月13日星期六00:06:19 EEST
- 转换机器:LM0 - 400 - 22516.local
📄 许可证
本模型使用的许可证为CC - BY - 4.0。



