Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,32 @@ metrics:
|
|
8 |
base_model:
|
9 |
- NlpHUST/t5-vi-en-base
|
10 |
pipeline_tag: translation
|
11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
base_model:
|
9 |
- NlpHUST/t5-vi-en-base
|
10 |
pipeline_tag: translation
|
11 |
+
---
|
12 |
+
|
13 |
+
|
14 |
+
# Machine translation for ancient Vietnamese
|
15 |
+
|
16 |
+
## How to use
|
17 |
+
|
18 |
+
```python
|
19 |
+
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
20 |
+
|
21 |
+
model = T5ForConditionalGeneration.from_pretrained("huyg1108/t5-ancient_vie-eng-base")
|
22 |
+
tokenizer = T5Tokenizer.from_pretrained("huyg1108/t5-ancient_vie-eng-base", legacy=False)
|
23 |
+
model.eval()
|
24 |
+
|
25 |
+
src = "Đạo chi vi vật, duy hoảng duy hốt."
|
26 |
+
tokenized_text = tokenizer.encode(src, return_tensors="pt")
|
27 |
+
summary_ids = model.generate(
|
28 |
+
tokenized_text,
|
29 |
+
max_length=64,
|
30 |
+
num_beams=7,
|
31 |
+
repetition_penalty=2.5,
|
32 |
+
length_penalty=1.0,
|
33 |
+
early_stopping=True
|
34 |
+
)
|
35 |
+
|
36 |
+
output = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
37 |
+
output
|
38 |
+
```
|
39 |
+
The Way governs things, only they are alarmed and sudden.
|