Update README.md
Browse files
README.md
CHANGED
|
@@ -13,4 +13,71 @@ tags:
|
|
| 13 |
- Machine-Translation
|
| 14 |
- Text-Generation
|
| 15 |
- Text-to-Text
|
| 16 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
- Machine-Translation
|
| 14 |
- Text-Generation
|
| 15 |
- Text-to-Text
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# English to Myanmar Translation Model
|
| 19 |
+
|
| 20 |
+
- အင်္ဂလိပ် ဘာသာစကားမှ မြန်မာ ဘာသာစကားသို့ ဘာသာပြန်ဆိုပေးနိုင်သော LLM based model တစ်ခု ဖြစ်ပါတယ်။
|
| 21 |
+
- Opus MT ကို custom dataset ဖြစ် tuning လုပ်ယူထားတာ ဖြစ်ပါတယ်။
|
| 22 |
+
- Total parameter 249M ရှိပါတယ်။
|
| 23 |
+
- Finetuning ကို Batch size = 16 နဲ့ Epochs = 50 ထိ သုံးထားပါတယ်။
|
| 24 |
+
|
| 25 |
+
## Reference
|
| 26 |
+
* [Based Model](https://huggingface.co/Helsinki-NLP/opus-mt-tc-bible-big-mul-mul)
|
| 27 |
+
* [Dataset](https://huggingface.co/datasets/Ko-Yin-Maung/Eng2Mm-Translation)
|
| 28 |
+
|
| 29 |
+
## Inference
|
| 30 |
+
```python
|
| 31 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 32 |
+
|
| 33 |
+
## load our model
|
| 34 |
+
model_name = "Ko-Yin-Maung/mig-mt-2.5b-eng-mya"
|
| 35 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 37 |
+
|
| 38 |
+
## Get the total number of parameters
|
| 39 |
+
total_params = sum(p.numel() for p in model.parameters())
|
| 40 |
+
print(f"Total number of parameters: {total_params}")
|
| 41 |
+
```
|
| 42 |
+
output
|
| 43 |
+
```console
|
| 44 |
+
Total number of parameters: 249793536
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Usage 1
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 50 |
+
|
| 51 |
+
model_name = "fine-tuned-model"
|
| 52 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 54 |
+
|
| 55 |
+
input_text = "Make up your own mind. It is fine by me if you want to do it."
|
| 56 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
| 57 |
+
outputs = model.generate(**inputs)
|
| 58 |
+
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 59 |
+
print(translated_text)
|
| 60 |
+
```
|
| 61 |
+
output
|
| 62 |
+
```console
|
| 63 |
+
ကိုယ့်ဟာကိုယ် ဆုံးဖြတ်ပါ။ အဆင်ပြေပါတယ် ၊ ခင်ဗျား လုပ်ချင်တယ်ဆိုရင် အဆင်ပြေပါတယ် ။
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Usage 2
|
| 67 |
+
```python
|
| 68 |
+
from transformers import pipeline
|
| 69 |
+
pipe = pipeline("translation", model="fine-tuned-model")
|
| 70 |
+
print(pipe(">>mya<< Would you please ask him to call me tomorrow?")[0])
|
| 71 |
+
```
|
| 72 |
+
output
|
| 73 |
+
```console
|
| 74 |
+
ကျွန်တော့် ဆီ မနက်ဖြန် ဖုန်းဆက်ဖို့ သူ့ကို ပြောပေးနိုင်မလား ။
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
လွတ်လပ်စွာ ကူးယူ လေ့လာခွင့် ရှိသည်။
|
| 78 |
+
|
| 79 |
+
(လေ့လာခြင်းဖြင့် ကျွန်ုပ်တို့၏ မနက်ဖြန်များကို ဖြတ်သန်းကြပါစို့..။)
|
| 80 |
+
|
| 81 |
+
@Created by Myanmar Innovative Group (MIG)
|
| 82 |
+
|
| 83 |
+
|