You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2020/09/27 07:15:05 UTC

[singa] branch master updated: fix some issues and requirements

This is an automated email from the ASF dual-hosted git repository.

wangwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/singa.git


The following commit(s) were added to refs/heads/master by this push:
     new 0edff7b  fix some issues and requirements
     new ba1782d  Merge pull request #801 from joddiy/add-ro_bert_a-requirements
0edff7b is described below

commit 0edff7babe3907f58783de3d5e00eef1ba287c00
Author: joddiy <jo...@qq.com>
AuthorDate: Thu Sep 24 11:28:31 2020 +0800

    fix some issues and requirements
---
 examples/onnx/gpt2/gpt2.py                 |  2 +-
 examples/onnx/ro_bert_a/requirements.txt   |  1 +
 examples/onnx/{ => ro_bert_a}/ro_bert_a.py | 12 ++----------
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/examples/onnx/gpt2/gpt2.py b/examples/onnx/gpt2/gpt2.py
index 56b7cfe..dd27334 100644
--- a/examples/onnx/gpt2/gpt2.py
+++ b/examples/onnx/gpt2/gpt2.py
@@ -106,5 +106,5 @@ if __name__ == "__main__":
         y = tensor.Tensor(device=dev, data=y)
         x = tensor.concatenate([x, y], 2)
 
-    text = tokenizer.decode(output)
+    text = postprocess(output)
     print(text)
\ No newline at end of file
diff --git a/examples/onnx/ro_bert_a/requirements.txt b/examples/onnx/ro_bert_a/requirements.txt
new file mode 100644
index 0000000..14693ad
--- /dev/null
+++ b/examples/onnx/ro_bert_a/requirements.txt
@@ -0,0 +1 @@
+transformers==2.5.1
\ No newline at end of file
diff --git a/examples/onnx/ro_bert_a.py b/examples/onnx/ro_bert_a/ro_bert_a.py
similarity index 95%
rename from examples/onnx/ro_bert_a.py
rename to examples/onnx/ro_bert_a/ro_bert_a.py
index 5b6ac0a..b6b02ed 100644
--- a/examples/onnx/ro_bert_a.py
+++ b/examples/onnx/ro_bert_a/ro_bert_a.py
@@ -17,10 +17,6 @@
 # under the License.
 #
 
-
-import sys
-sys.path.append('/singa/build/python/')
-
 import os
 import numpy as np
 
@@ -30,6 +26,8 @@ from singa import sonnx
 from singa import autograd
 import onnx
 
+import sys
+sys.path.append(os.path.dirname(__file__) + '/..')
 from utils import download_model, check_exist_or_download
 
 import logging
@@ -45,12 +43,6 @@ def preprocess():
     tokens = np.array(tokens)
     return tokens.reshape([1, -1]).astype(np.float32)
 
-
-def postprocess(out):
-    text = tokenizer.decode(out)
-    return text
-
-
 class MyModel(sonnx.SONNXModel):
 
     def __init__(self, onnx_model):