🚀 flan - t5 - base - opus - en - id - id - en
このモデルは、インドネシア語と英語のみの多言語翻訳を行うための翻訳モデルです。
🚀 クイックスタート
このモデルは、インドネシア語と英語の間の翻訳を行うために設計されています。以下に、使用方法の例を示します。
✨ 主な機能
📚 ドキュメント
モデル詳細
モデルの使用方法
モデルの実行環境
このモデルは、CPU、GPUで実行することができます。また、GPUでは異なる精度(FP16、INT8)での実行もサポートしています。
コード例
以下に、異なる環境でのモデルの実行例を示します。
💻 使用例
基本的な使用法
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en")
model = T5ForConditionalGeneration.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en")
input_text = "translate English to Indonesia: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
高度な使用法
GPUでの実行
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en")
model = T5ForConditionalGeneration.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en", device_map="auto")
input_text = "translate English to Indonesia: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
GPUでのFP16精度での実行
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-ene")
model = T5ForConditionalGeneration.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en", device_map="auto", torch_dtype=torch.float16)
input_text = "translate English to Indonesia: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
GPUでのINT8精度での実行
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en")
model = T5ForConditionalGeneration.from_pretrained("muvazana/flan-t5-base-opus-en-id-id-en", device_map="auto", load_in_8bit=True)
input_text = "translate English to Indonesia: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
学習結果
学習損失 |
エポック |
ステップ |
検証損失 |
スコア |
カウント |
合計 |
精度 |
Bp |
システム長 |
参照長 |
生成長 |
1.6959 |
0.55 |
4000 |
1.5776 |
30.6542 |
[4414, 2368, 1345, 733] |
[7417, 6417, 5426, 4519] |
[59.511932047997846, 36.9019791179679, 24.78805750092149, 16.220402743969906] |
1.0 |
7417 |
7354 |
10.77 |
1.4378 |
1.11 |
8000 |
1.4527 |
32.3772 |
[4526, 2538, 1483, 834] |
[7567, 6567, 5576, 4666] |
[59.81234306858729, 38.647784376427595, 26.596126255380202, 17.873981997428203] |
1.0 |
7567 |
7354 |
10.885 |
1.3904 |
1.66 |
12000 |
1.3961 |
33.8978 |
[4558, 2559, 1494, 836] |
[7286, 6286, 5295, 4383] |
[62.55833104584134, 40.70951320394528, 28.21529745042493, 19.073693817020306] |
0.9907 |
7286 |
7354 |
10.569 |
1.3035 |
2.21 |
16000 |
1.3758 |
34.9471 |
[4609, 2628, 1546, 880] |
[7297, 6297, 5306, 4392] |
[63.16294367548308, 41.73415912339209, 29.136826234451565, 20.036429872495447] |
0.9922 |
7297 |
7354 |
10.591 |
1.2994 |
2.77 |
20000 |
1.3685 |
35.0259 |
[4617, 2627, 1550, 883] |
[7288, 6288, 5297, 4382] |
[63.350713501646545, 41.777989821882954, 29.261846328110252, 20.150616157005935] |
0.991 |
7288 |
7354 |
10.556 |
フレームワークのバージョン
- Transformers 4.29.2
- Pytorch 2.0.1
- Datasets 2.13.1
- Tokenizers 0.13.3
📄 ライセンス
このモデルは、Apache 2.0ライセンスの下で提供されています。