Instructions to use minhtoan/t5-translate-lao-vietnamese with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use minhtoan/t5-translate-lao-vietnamese with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="minhtoan/t5-translate-lao-vietnamese")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("minhtoan/t5-translate-lao-vietnamese") model = AutoModelForSeq2SeqLM.from_pretrained("minhtoan/t5-translate-lao-vietnamese", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- vi
|
| 4 |
+
- lo
|
| 5 |
+
tags:
|
| 6 |
+
- translation
|
| 7 |
+
license: mit
|
| 8 |
+
widget:
|
| 9 |
+
- text: "ຂ້ອຍຢາກຊື້ປຶ້ມ"
|
| 10 |
+
inference:
|
| 11 |
+
parameters:
|
| 12 |
+
max_length: 200
|
| 13 |
+
pipeline_tag: translation
|
| 14 |
+
library_name: transformers
|
| 15 |
+
---
|
| 16 |
+
# Lao - Vietnamese Translation Model
|
| 17 |
+
In the domain of natural language processing (NLP), the development of translation models tailored for low-resource languages represents a critical endeavor to facilitate cross-cultural communication and knowledge exchange. In response to this challenge, we present a novel and impactful contribution: a translation model specifically designed to bridge the linguistic gap between Lao and Vietnamese.
|
| 18 |
+
|
| 19 |
+
Lao, a language spoken primarily in Laos and parts of Thailand, presents inherent challenges for machine translation due to its low-resource nature, characterized by limited parallel corpora and linguistic resources. Vietnamese, a language spoken by millions worldwide, shares some linguistic similarities with Lao, making it an ideal target language for translation purposes.
|
| 20 |
+
|
| 21 |
+
Leveraging the power of the Transformer-based T5 model, we have developed a robust translation system for the Lao-Vietnamese language pair. The T5 model, renowned for its versatility and effectiveness across various NLP tasks, serves as the cornerstone of our approach. Through fine-tuning on a curated dataset of Lao-Vietnamese parallel texts, we have endeavored to enhance translation accuracy and fluency, thus enabling smoother communication between speakers of these languages.
|
| 22 |
+
|
| 23 |
+
Our work represents a significant advancement in the field of machine translation, particularly for low-resource languages like Lao. By harnessing state-of-the-art NLP techniques and focusing on the specific linguistic nuances of the Lao-Vietnamese language pair, we aim to provide a valuable resource for facilitating cross-linguistic communication and cultural exchange.
|
| 24 |
+
## How to use
|
| 25 |
+
### On GPU
|
| 26 |
+
```python
|
| 27 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained("minhtoan/t5-translate-lao-vietnamese")
|
| 29 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("minhtoan/t5-translate-lao-vietnamese")
|
| 30 |
+
model.cuda()
|
| 31 |
+
src = "ຂ້ອຍຢາກຊື້ປຶ້ມາ"
|
| 32 |
+
tokenized_text = tokenizer.encode(src, return_tensors="pt").cuda()
|
| 33 |
+
model.eval()
|
| 34 |
+
translate_ids = model.generate(tokenized_text, max_length=200)
|
| 35 |
+
output = tokenizer.decode(translate_ids[0], skip_special_tokens=True)
|
| 36 |
+
output
|
| 37 |
+
```
|
| 38 |
+
'Tôi muốn mua một cuốn sách'
|
| 39 |
+
|
| 40 |
+
### On CPU
|
| 41 |
+
```python
|
| 42 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained("minhtoan/t5-translate-lao-vietnamese")
|
| 44 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("minhtoan/t5-translate-lao-vietnamese")
|
| 45 |
+
src = "ຂ້ອຍຢາກຊື້ປຶ້ມ"
|
| 46 |
+
input_ids = tokenizer(src, max_length=200, return_tensors="pt", padding="max_length", truncation=True).input_ids
|
| 47 |
+
outputs = model.generate(input_ids=input_ids, max_new_tokens=200)
|
| 48 |
+
output = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
|
| 49 |
+
output
|
| 50 |
+
```
|
| 51 |
+
'Tôi muốn mua một cuốn sách'
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
## Author
|
| 56 |
+
`
|
| 57 |
+
Phan Minh Toan
|
| 58 |
+
`
|