hieunguyen1053
commited on
Commit
•
43cadd0
1
Parent(s):
1e04e87
update README
Browse files
README.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- vi
|
5 |
+
|
6 |
+
tags:
|
7 |
+
- translation
|
8 |
+
|
9 |
license: apache-2.0
|
10 |
---
|
11 |
+
|
12 |
+
# MarianMT exported to the ONNX format
|
13 |
+
|
14 |
+
## Install Optimum
|
15 |
+
```bash
|
16 |
+
pip install optimum
|
17 |
+
```
|
18 |
+
|
19 |
+
## Usage example
|
20 |
+
|
21 |
+
```python
|
22 |
+
from transformers import AutoTokenizer
|
23 |
+
from optimum.onnxruntime import ORTModelForSeq2SeqLM
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained("icon-it-tdtu/mt-en-vi-optimum")
|
25 |
+
model = ORTModelForSeq2SeqLM.from_pretrained("icon-it-tdtu/mt-en-vi-optimum")
|
26 |
+
|
27 |
+
text = "I am a student."
|
28 |
+
inputs = tokenizer(text, return_tensors='pt')
|
29 |
+
outputs = model.generate(**inputs)
|
30 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
31 |
+
print(result)
|
32 |
+
# Tôi là một sinh viên.
|
33 |
+
```
|