File size: 1,247 Bytes
226f02c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
metrics:
- sacrebleu
language:
- en
- th
---

# NLLB 600M TH-EN finetuned
This model is finetuned from [facebook/nllb-200-distilled-600M](https://huggingface.co/facebook/nllb-200-distilled-600M) using SCB-1M and OPUS dataset. 
The finetuning script is on [GitHub](https://github.com/wtarit/th-en-machine-translation/tree/main/NLLB).  
View full finetuning logs on [wandb](https://wandb.ai/wtarit/NLLB%20TH-EN%20Machine%20Translation/runs/5ma65zoy).

## Usage
```Python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
import torch

MODEL_NAME = "wtarit/nllb-600M-th-en"

model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
device = 0 if torch.cuda.is_available() else "cpu"

translation_pipeline = pipeline(
    "translation", 
    model=model, 
    tokenizer=tokenizer, 
    src_lang="tha_Thai", 
    tgt_lang="eng_Latn", 
    max_length=400, 
    device=device
)

# Run translation pipeline
result = translation_pipeline("สวัสดี เราคือโมเดลแปลภาษา")
print(result[0]['translation_text'])
```

## Score
BLEU Score (Using [sacrebleu](https://huggingface.co/spaces/evaluate-metric/sacrebleu)): 27.37 on IWSLT 2015