File size: 1,034 Bytes
e1c0f32
 
 
b0ea199
e1c0f32
 
 
 
 
 
 
 
 
 
 
9144e1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e1c0f32
 
 
 
 
 
 
 
 
 
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
43
---
language:
- en
- vi
tags:
- translation
license: apache-2.0
datasets:
- ALT
metrics:
- sacrebleu
---

This is a finetuning of a MarianMT pretrained on Chinese-English. The target language pair is Vietnamese-English.

### Example
```
%%capture
!pip install transformers transformers[sentencepiece]

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
# Download the pretrained model for English-Vietnamese available on the hub
model = AutoModelForSeq2SeqLM.from_pretrained("CLAck/vi-en")

tokenizer = AutoTokenizer.from_pretrained("CLAck/vi-en")

sentence = your_vietnamese_sentence
# This token is needed to identify the source language
input_sentence = "<2vi> " + sentence 
translated = model.generate(**tokenizer(input_sentence, return_tensors="pt", padding=True))
output_sentence = [tokenizer.decode(t, skip_special_tokens=True) for t in translated]
```

### Training results

| Epoch | Bleu    |
|:-----:|:-------:|
| 1.0   | 21.3180 |
| 2.0   | 26.8012 |
| 3.0   | 29.3578 |
| 4.0   | 31.5178 |
| 5.0   | 32.8740 |