Update README.md
Browse files
README.md
CHANGED
|
@@ -1,122 +1,171 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
-
- eng
|
| 4 |
-
- tig
|
| 5 |
tags:
|
| 6 |
- tokenizer
|
| 7 |
- machine-translation
|
| 8 |
- low-resource
|
| 9 |
- geez-script
|
|
|
|
|
|
|
| 10 |
license: mit
|
| 11 |
datasets:
|
| 12 |
-
- nllb
|
| 13 |
-
- opus
|
| 14 |
metrics:
|
| 15 |
- bleu
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# English–Tigrinya Machine Translation
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
---
|
| 27 |
|
| 28 |
-
##
|
| 29 |
|
| 30 |
-
This repository provides a **custom tokenizer** and a **fine-tuned MarianMT model** for **English ↔ Tigrinya machine translation**.
|
| 31 |
-
It leverages the NLLB dataset for training and OPUS parallel corpora for testing and evaluation, with BLEU used as the primary metric.
|
| 32 |
|
| 33 |
-
|
| 34 |
-
- **Tokenizer:** SentencePiece, customized for Geez-script representation
|
| 35 |
-
- **Model:** MarianMT (multilingual transformer) fine-tuned for English–Tigrinya translation
|
| 36 |
-
- **License:** MIT
|
| 37 |
|
| 38 |
---
|
| 39 |
|
| 40 |
-
##
|
| 41 |
|
| 42 |
-
|
| 43 |
-
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
-
##
|
| 56 |
-
|
| 57 |
-
- **Training Dataset**: NLLB Parallel Corpus (English ↔ Tigrinya)
|
| 58 |
-
- **Testing Dataset**: OPUS Parallel Corpus
|
| 59 |
-
- **Epochs**: 3
|
| 60 |
-
- **Batch Size**: 8
|
| 61 |
-
- **Max Sequence Length**: 128 tokens
|
| 62 |
-
- **Learning Rate**: `1.44e-07` with decay
|
| 63 |
|
| 64 |
-
|
| 65 |
-
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
**
|
| 71 |
-
- Epoch 1: 1.14
|
| 72 |
-
- Epoch 2: 1.11
|
| 73 |
-
- Epoch 3: 1.06
|
| 74 |
|
| 75 |
-
|
| 76 |
-
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
---
|
| 80 |
|
| 81 |
-
##
|
| 82 |
|
| 83 |
-
|
| 84 |
-
- **Evaluation Dataset**: OPUS parallel English–Tigrinya
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
|
| 94 |
```python
|
| 95 |
from transformers import MarianMTModel, MarianTokenizer
|
| 96 |
|
| 97 |
-
|
| 98 |
-
model_name = "Hailay/MachineT_TigEng"
|
| 99 |
model = MarianMTModel.from_pretrained(model_name)
|
| 100 |
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
inputs = tokenizer(english_text, return_tensors="pt", padding=True, truncation=True)
|
| 105 |
translated = model.generate(**inputs)
|
| 106 |
-
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
|
|
|
| 111 |
|
| 112 |
-
##
|
| 113 |
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
year = {2025},
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
+
- eng
|
| 4 |
+
- tig
|
| 5 |
tags:
|
| 6 |
- tokenizer
|
| 7 |
- machine-translation
|
| 8 |
- low-resource
|
| 9 |
- geez-script
|
| 10 |
+
- marianmt
|
| 11 |
+
- sentencepiece
|
| 12 |
license: mit
|
| 13 |
datasets:
|
| 14 |
+
- nllb
|
| 15 |
+
- opus
|
| 16 |
metrics:
|
| 17 |
- bleu
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# English–Tigrinya Machine Translation Model
|
| 21 |
|
| 22 |
+
[](https://doi.org/10.1109/FLLM67465.2025.11390974)
|
| 23 |
+
[](https://huggingface.co/Hailay/MachineT_TigEng)
|
| 24 |
+
[](LICENSE)
|
| 25 |
+
[]()
|
| 26 |
|
| 27 |
+
> **Low-Resource English–Tigrinya MT: Leveraging Multilingual Models, Custom Tokenizers, and Clean Evaluation Benchmarks**
|
| 28 |
+
> Hailay Kidu Teklehaymanot, G. Gebremariam Gidey, Wolfgang Nejdl
|
| 29 |
+
> *3rd International Conference on Foundation and Large Language Models (FLLM 2025)*, pp. 121–128
|
| 30 |
+
> 📍 25–28 November 2025 | Vienna, Austria | [DOI: 10.1109/FLLM67465.2025.11390974](https://doi.org/10.1109/FLLM67465.2025.11390974)
|
| 31 |
|
| 32 |
---
|
| 33 |
|
| 34 |
+
## Overview
|
| 35 |
|
| 36 |
+
This repository provides a **custom SentencePiece tokenizer** and a **fine-tuned MarianMT model** for bidirectional **English ↔ Tigrinya machine translation**. Tigrinya is a low-resource Ge'ez-script language spoken primarily in Eritrea and the Tigray region of Ethiopia, and is significantly underrepresented in standard multilingual NLP models.
|
|
|
|
| 37 |
|
| 38 |
+
The model is trained on the NLLB parallel corpus and evaluated against OPUS parallel data using BLEU, addressing the lack of clean, reliable translation benchmarks for this language pair.
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
---
|
| 41 |
|
| 42 |
+
## Model Details
|
| 43 |
|
| 44 |
+
| Property | Value |
|
| 45 |
+
|----------------------|-------------------------------------------------|
|
| 46 |
+
| **Task** | Bidirectional Machine Translation (EN ↔ TIG) |
|
| 47 |
+
| **Base Model** | MarianMT (multilingual transformer) |
|
| 48 |
+
| **Tokenizer** | SentencePiece, customized for Ge'ez script |
|
| 49 |
+
| **Training Data** | NLLB Parallel Corpus (English–Tigrinya) |
|
| 50 |
+
| **Evaluation Data** | OPUS Parallel Corpus (English–Tigrinya) |
|
| 51 |
+
| **Evaluation Metric**| BLEU |
|
| 52 |
+
| **Frameworks** | Hugging Face Transformers, PyTorch |
|
| 53 |
+
| **License** | MIT |
|
| 54 |
|
| 55 |
---
|
| 56 |
|
| 57 |
+
## Training Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
| Parameter | Value |
|
| 60 |
+
|------------------------|------------------------------|
|
| 61 |
+
| Epochs | 3 |
|
| 62 |
+
| Batch size | 8 |
|
| 63 |
+
| Max sequence length | 128 tokens |
|
| 64 |
+
| Learning rate | `1.44e-07` with decay |
|
| 65 |
+
| Training time | ~12 hours (43,376.7s) |
|
| 66 |
+
| Training speed | 96.7 samples/sec |
|
| 67 |
+
| Steps per second | 12.08 |
|
| 68 |
|
| 69 |
+
**Training Loss per Epoch**
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
| Epoch | Loss | Gradient Norm |
|
| 72 |
+
|-------|--------|---------------|
|
| 73 |
+
| 1 | 0.4430 | 1.14 |
|
| 74 |
+
| 2 | 0.4077 | 1.11 |
|
| 75 |
+
| 3 | 0.4379 | 1.06 |
|
| 76 |
+
| Final | 0.4756 | — |
|
| 77 |
|
| 78 |
---
|
| 79 |
|
| 80 |
+
## Usage
|
| 81 |
|
| 82 |
+
The model supports translation in **both directions**. The direction is controlled by a language prefix token passed to the tokenizer.
|
|
|
|
| 83 |
|
| 84 |
+
### English → Tigrinya
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
from transformers import MarianMTModel, MarianTokenizer
|
| 88 |
+
|
| 89 |
+
model_name = "Hailay/MachineT_TigEng"
|
| 90 |
+
model = MarianMTModel.from_pretrained(model_name)
|
| 91 |
+
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 92 |
|
| 93 |
+
english_text = "We must obey the Lord and leave them alone"
|
| 94 |
+
inputs = tokenizer(english_text, return_tensors="pt", padding=True, truncation=True)
|
| 95 |
+
translated = model.generate(**inputs)
|
| 96 |
+
print(tokenizer.decode(translated[0], skip_special_tokens=True))
|
| 97 |
+
```
|
| 98 |
|
| 99 |
+
### Tigrinya → English
|
| 100 |
|
| 101 |
+
Prepend `>>eng<<` to tell the model to produce English output:
|
| 102 |
|
| 103 |
```python
|
| 104 |
from transformers import MarianMTModel, MarianTokenizer
|
| 105 |
|
| 106 |
+
model_name = "Hailay/MachineT_TigEng"
|
|
|
|
| 107 |
model = MarianMTModel.from_pretrained(model_name)
|
| 108 |
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 109 |
|
| 110 |
+
tigrinya_text = ">>eng<< ንሕና ንእግዚኣብሔር ክንእዘዝ ኣሎና"
|
| 111 |
+
inputs = tokenizer(tigrinya_text, return_tensors="pt", padding=True, truncation=True)
|
|
|
|
| 112 |
translated = model.generate(**inputs)
|
| 113 |
+
print(tokenizer.decode(translated[0], skip_special_tokens=True))
|
| 114 |
+
```
|
| 115 |
|
| 116 |
+
### Batch Translation
|
| 117 |
|
| 118 |
+
```python
|
| 119 |
+
sentences = [
|
| 120 |
+
"We must obey the Lord and leave them alone",
|
| 121 |
+
"The children are learning at school today",
|
| 122 |
+
"Peace is important for all nations",
|
| 123 |
+
]
|
| 124 |
+
|
| 125 |
+
inputs = tokenizer(sentences, return_tensors="pt", padding=True, truncation=True)
|
| 126 |
+
translated = model.generate(**inputs)
|
| 127 |
+
for t in translated:
|
| 128 |
+
print(tokenizer.decode(t, skip_special_tokens=True))
|
| 129 |
+
```
|
| 130 |
|
| 131 |
+
---
|
| 132 |
|
| 133 |
+
## Model Card
|
| 134 |
|
| 135 |
+
This model is designed for general-domain English ↔ Tigrinya translation. It performs well on a broad range of everyday text but may underperform on highly domain-specific or technical content without further fine-tuning. It is intended as a research baseline and a practical resource for the low-resource NLP community.
|
| 136 |
+
|
| 137 |
+
**Limitations:**
|
| 138 |
+
- Trained on 3 epochs; further training may improve BLEU scores
|
| 139 |
+
- Performance on highly formal or domain-specific text (legal, medical) is not evaluated
|
| 140 |
+
- Tigrinya dialectal variation (Eritrean vs. Ethiopian) may affect output quality
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
|
| 144 |
+
## Citation
|
| 145 |
+
|
| 146 |
+
If you use this model, tokenizer, or evaluation benchmark in your work, please cite:
|
| 147 |
+
|
| 148 |
+
```bibtex
|
| 149 |
+
@inproceedings{teklehaymanot2025lowresource,
|
| 150 |
+
title = {Low-Resource {E}nglish--{T}igrinya {MT}: Leveraging Multilingual Models,
|
| 151 |
+
Custom Tokenizers, and Clean Evaluation Benchmarks},
|
| 152 |
+
author = {Teklehaymanot, Hailay Kidu and Gebremariam Gidey, G. and Nejdl, Wolfgang},
|
| 153 |
+
booktitle = {2025 3rd International Conference on Foundation and Large
|
| 154 |
+
Language Models (FLLM)},
|
| 155 |
year = {2025},
|
| 156 |
+
address = {Vienna, Austria},
|
| 157 |
+
month = {November},
|
| 158 |
+
pages = {121--128},
|
| 159 |
+
doi = {10.1109/FLLM67465.2025.11390974},
|
| 160 |
+
publisher = {IEEE}
|
| 161 |
}
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## Acknowledgements
|
| 167 |
+
|
| 168 |
+
- Training corpus: [NLLB](https://huggingface.co/datasets/allenai/nllb) (No Language Left Behind, Meta AI)
|
| 169 |
+
- Evaluation corpus: [OPUS](https://opus.nlpl.eu/) parallel data
|
| 170 |
+
- Base model: [MarianMT](https://huggingface.co/docs/transformers/model_doc/marian) via Hugging Face Transformers
|
| 171 |
+
- This work was carried out at the [L3S Research Center](https://www.l3s.de), Leibniz Universität Hannover.
|