đ flan-t5-base-opus-en-id-id-en
This model serves as a translator specifically for multimodal translation between Indonesian and English, offering a practical solution for language conversion tasks between these two languages.
đ Quick Start
This model is a language model designed for translating between English and Indonesian. Below are some usage examples to help you get started.
⨠Features
- Multilingual Translation: Specialized in translating between English and Indonesian.
- Multiple Running Environments: Can run on both CPU and GPU, and supports different precision modes on GPU.
đĻ Installation
To use this model, you need to install the transformers
library. You can install it using the following command:
pip install transformers
If you want to run the model on GPU, you also need to install accelerate
and bitsandbytes
(for INT8 precision):
pip install accelerate
pip install bitsandbytes
đģ Usage Examples
Basic Usage
Running the model on a CPU
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]))
Running the model on a 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]))
Advanced Usage
Running the model on a GPU using FP16 precision
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]))
Running the model on a GPU using INT8 precision
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]))
đ Documentation
Model Details
Model Description
Property |
Details |
Model Type |
Language model |
Language(s) (NLP) |
English, Indonesian |
License |
Apache 2.0 |
Training results
Training Loss |
Epoch |
Step |
Validation Loss |
Score |
Counts |
Totals |
Precisions |
Bp |
Sys Len |
Ref Len |
Gen Len |
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 |
Framework versions
- Transformers 4.29.2
- Pytorch 2.0.1
- Datasets 2.13.1
- Tokenizers 0.13.3
đ License
This model is licensed under the Apache 2.0 license.