n-pn commited on
Commit
bba7582
·
verified ·
1 Parent(s): 61cff74

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -0
README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mpl-2.0
3
+ language:
4
+ - vi
5
+ - zh
6
+ pipeline_tag: translation
7
+ ---
8
+
9
+ ## How to run:
10
+
11
+ ```python
12
+ import torch
13
+ import time
14
+ from transformers import AutoTokenizer, pipeline
15
+ from optimum.onnxruntime import ORTModelForSeq2SeqLM
16
+
17
+ model = ORTModelForSeq2SeqLM.from_pretrained("chi-vi/hirashiba-mt-tiny-zh-vi-onnx")
18
+ tokenizer = AutoTokenizer.from_pretrained("chi-vi/hirashiba-mt-tiny-zh-vi-onnx")
19
+
20
+ with open("test.txt") as f:
21
+ text = f.readlines()
22
+
23
+ start_time = time.time()
24
+
25
+ pipe = pipeline("translation", model=model, tokenizer=tokenizer, device=0)
26
+ result = pipe(text)
27
+ print(result)
28
+
29
+ print("--- %s seconds ---" % (time.time() - start_time))
30
+ ```