模型简介
模型特点
模型能力
使用案例
🚀 opus-mt-tc-bible-big-deu_eng_fra_por_spa-mul
这是一款用于从德语、英语、法语、葡萄牙语和西班牙语翻译到多种语言的神经机器翻译模型。它能助力用户实现多语言间的文本翻译和文本生成,但由于部分语言训练数据有限,翻译效果可能参差不齐。
🚀 快速开始
以下是使用该模型进行翻译的简短示例代码:
基础用法
from transformers import MarianMTModel, MarianTokenizer
src_text = [
">>aai<< Replace this with text in an accepted source language.",
">>zza<< This is the second sentence."
]
model_name = "pytorch-models/opus-mt-tc-bible-big-deu_eng_fra_por_spa-mul"
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) )
你也可以使用transformers
的管道(pipeline
)来使用OPUS - MT模型:
高级用法
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-bible-big-deu_eng_fra_por_spa-mul")
print(pipe(">>aai<< Replace this with text in an accepted source language."))
✨ 主要特性
- 多语言支持:支持从德语、英语、法语、葡萄牙语和西班牙语翻译到多种目标语言。
- 开源框架:基于Marian NMT框架训练,并使用transformers库转换为pyTorch模型,方便开发者使用。
📦 安装指南
文档未提及安装步骤,可参考相关依赖库(如transformers
)的官方安装说明。
📚 详细文档
模型详情
这是一个用于从未知(德语 + 英语 + 法语 + 葡萄牙语 + 西班牙语)翻译到多种语言(mul)的神经机器翻译模型。需要注意的是,由于大多数语言的训练数据非常有限,模型对许多列出的语言支持并不理想。翻译性能差异很大,对于大量的语言对,模型可能根本无法工作。
该模型是OPUS - MT项目的一部分,该项目致力于让神经机器翻译模型在世界上的多种语言中广泛可用和可访问。所有模型最初都使用Marian NMT这个出色的框架进行训练,它是一个用纯C++编写的高效NMT实现。这些模型已通过huggingface的transformers库转换为pyTorch。训练数据来自OPUS,训练管道使用OPUS - MT - train的程序。
属性 | 详情 |
---|---|
开发者 | 赫尔辛基大学语言技术研究小组 |
模型类型 | 翻译(transformer - big) |
发布时间 | 2024 - 05 - 30 |
许可证 | Apache - 2.0 |
源语言 | 德语、英语、法语、葡萄牙语、西班牙语 |
目标语言 | 众多语言(文档中详细列出) |
原始模型 | opusTCv20230926max50+bt+jhubc_transformer - big_2024 - 05 - 30.zip |
更多信息资源 | OPUS - MT仪表盘;OPUS - MT - train GitHub仓库;transformers库中关于MarianNMT模型的更多信息;Tatoeba翻译挑战;HPLT双语数据v1(作为Tatoeba翻译挑战数据集的一部分);大规模并行圣经语料库 |
这是一个具有多个目标语言的多语言翻译模型。需要以>>id<<
(id = 有效的目标语言ID)的形式提供句子初始语言标记,例如>>aai<<
。
用途
该模型可用于翻译和文本到文本的生成。
风险、限制和偏差
⚠️ 重要提示
读者应该注意,该模型是在各种公共数据集上训练的,这些数据集可能包含令人不安、冒犯性的内容,并且可能传播历史和当前的刻板印象。
大量研究已经探讨了语言模型的偏差和公平性问题(例如,参见Sheng等人(2021)和Bender等人(2021))。
此外,由于大多数语言的训练数据非常有限,模型对许多列出的语言支持并不理想。翻译性能差异很大,对于大量的语言对,模型可能根本无法工作。
训练
- 数据:opusTCv20230926max50+bt+jhubc(来源)
- 预处理:SentencePiece(spm32k,spm32k)
- 模型类型:transformer - big
- 原始MarianNMT模型:opusTCv20230926max50+bt+jhubc_transformer - big_2024 - 05 - 30.zip
- 训练脚本:GitHub仓库
评估
- OPUS - MT仪表盘上的模型得分
- 测试集翻译:opusTCv20230926max50+bt+jhubc_transformer - big_2024 - 05 - 29.test.txt
- 测试集得分:opusTCv20230926max50+bt+jhubc_transformer - big_2024 - 05 - 29.eval.txt
- 基准测试结果:benchmark_results.txt
- 基准测试输出:benchmark_translations.zip
语言对 | 测试集 | chr - F | BLEU | 句子数量 | 单词数量 |
---|---|---|---|---|---|
multi - multi | tatoeba - test - v2020 - 07 - 28 - v2023 - 09 - 26 | 0.55024 | 29.2 | 10000 | 75838 |
引用信息
- 出版物:Democratizing neural machine translation with OPUS - MT、OPUS - MT – Building open translation services for the World和The Tatoeba Translation Challenge – Realistic Data Sets for Low Resource and Multilingual MT(如果使用此模型,请引用)
@article{tiedemann2023democratizing,
title={Democratizing neural machine translation with {OPUS-MT}},
author={Tiedemann, J{\"o}rg and Aulamo, Mikko and Bakshandaeva, Daria and Boggia, Michele and Gr{\"o}nroos, Stig-Arne and Nieminen, Tommi and Raganato, Alessandro and Scherrer, Yves and Vazquez, Raul and Virpioja, Sami},
journal={Language Resources and Evaluation},
number={58},
pages={713--755},
year={2023},
publisher={Springer Nature},
issn={1574-0218},
doi={10.1007/s10579-023-09704-w}
}
@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",
}
致谢
这项工作得到了HPLT项目的支持,该项目由欧盟的Horizon Europe研究和创新计划资助,资助协议编号为101070350。我们也感谢CSC -- IT Center for Science(芬兰)和EuroHPC超级计算机LUMI提供的慷慨计算资源和IT基础设施。
模型转换信息
- transformers版本:4.45.1
- OPUS - MT git哈希值:0882077
- 转换时间:Wed Oct 9 18:54:16 EEST 2024
- 转换机器:LM0 - 400 - 22516.local
📄 许可证
本模型使用的许可证为Apache - 2.0。



