File size: 653 Bytes
1820ef4 43cadd0 1820ef4 43cadd0 |
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 |
---
language:
- en
- vi
tags:
- translation
license: apache-2.0
---
# MarianMT exported to the ONNX format
## Install Optimum
```bash
pip install optimum
```
## Usage example
```python
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("icon-it-tdtu/mt-en-vi-optimum")
model = ORTModelForSeq2SeqLM.from_pretrained("icon-it-tdtu/mt-en-vi-optimum")
text = "I am a student."
inputs = tokenizer(text, return_tensors='pt')
outputs = model.generate(**inputs)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)
# Tôi là một sinh viên.
``` |