🚀 opus-mt-tc-big-en-gmq
このモデルは、英語(en)から北ゲルマン諸語(gmq)への翻訳を行うためのニューラル機械翻訳モデルです。OPUS - MTプロジェクトの一部として、世界中の多くの言語に対してニューラル機械翻訳モデルを広く利用可能にする取り組みの一環です。
🚀 クイックスタート
このモデルを使って英語から北ゲルマン諸語への翻訳を行うことができます。以下に簡単な使用例を示します。
from transformers import MarianMTModel, MarianTokenizer
src_text = [
">>nno<< The United States borders Canada.",
">>nob<< This is the biggest hotel in this city."
]
model_name = "pytorch-models/opus-mt-tc-big-en-gmq"
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のパイプラインを使用することもできます。
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-gmq")
print(pipe(">>nno<< The United States borders Canada."))
✨ 主な機能
- 英語から北ゲルマン諸語へのニューラル機械翻訳を行うことができます。
- 複数のターゲット言語に対応しており、文頭に言語トークンを指定することで翻訳先の言語を選択できます。
📦 インストール
このモデルを使用するには、transformers
ライブラリが必要です。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
from transformers import MarianMTModel, MarianTokenizer
src_text = [
">>nno<< The United States borders Canada.",
">>nob<< This is the biggest hotel in this city."
]
model_name = "pytorch-models/opus-mt-tc-big-en-gmq"
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) )
高度な使用法
from transformers import pipeline
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-gmq")
print(pipe(">>nno<< The United States borders Canada."))
📚 ドキュメント
モデル情報
ベンチマーク
言語ペア |
テストセット |
chr - F |
BLEU |
文数 |
単語数 |
eng - dan |
tatoeba - test - v2021 - 08 - 07 |
0.75165 |
61.6 |
10795 |
79385 |
eng - fao |
tatoeba - test - v2021 - 08 - 07 |
0.40395 |
18.3 |
294 |
1933 |
eng - isl |
tatoeba - test - v2021 - 08 - 07 |
0.59731 |
39.9 |
2503 |
19023 |
eng - nno |
tatoeba - test - v2021 - 08 - 07 |
0.61271 |
40.1 |
460 |
3428 |
eng - nob |
tatoeba - test - v2021 - 08 - 07 |
0.72380 |
57.3 |
4539 |
36119 |
eng - swe |
tatoeba - test - v2021 - 08 - 07 |
0.74197 |
60.9 |
10362 |
68067 |
eng - dan |
flores101 - devtest |
0.70810 |
47.7 |
1012 |
24638 |
eng - isl |
flores101 - devtest |
0.52076 |
24.1 |
1012 |
22834 |
eng - nob |
flores101 - devtest |
0.62760 |
34.5 |
1012 |
23873 |
eng - swe |
flores101 - devtest |
0.70129 |
46.9 |
1012 |
23121 |
eng - isl |
newsdev2021.en - is |
0.50376 |
22.6 |
2004 |
43721 |
eng - isl |
newstest2021.en - is |
0.50516 |
21.5 |
1000 |
25233 |
引用
@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",
}
🔧 技術詳細
- このモデルは、Marian NMTという効率的なNMT実装を用いて元々トレーニングされ、huggingfaceのtransformersライブラリを使ってpyTorchに変換されています。
- トレーニングデータはOPUSから取得され、トレーニングパイプラインはOPUS - MT - trainの手順を使用しています。
📄 ライセンス
このモデルはCC - BY - 4.0ライセンスの下で提供されています。
謝辞
この研究は、European Language Gridのpilot project 2866、FoTran project(European Research Council (ERC)によるEuropean Union’s Horizon 2020 research and innovation programmeの助成(助成契約番号771113))、およびMeMAD project(European Union’s Horizon 2020 Research and Innovation Programmeの助成(助成契約番号780069))によって支援されています。また、フィンランドのCSC -- IT Center for Scienceが提供する計算資源とITインフラストラクチャに感謝します。
モデル変換情報
- transformersバージョン: 4.16.2
- OPUS - MTのgitハッシュ: 3405783
- ポート時間: Wed Apr 13 17:14:46 EEST 2022
- ポートマシン: LM0 - 400 - 22516.local