singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wang...@apache.org
Subject [2/3] incubator-singa git commit: SINGA-369 fix the errors in examples fix the error of UnicodeDecodeError
Date Sat, 19 May 2018 09:42:09 GMT
SINGA-369 fix the errors in examples
fix the error of UnicodeDecodeError


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/32b00c06
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/32b00c06
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/32b00c06

Branch: refs/heads/master
Commit: 32b00c06e2c7c40a87244ea7c1311013da1e92e8
Parents: 01b29b3
Author: sheyujian <sheyujian@me.com>
Authored: Fri May 18 16:16:04 2018 +0800
Committer: sheyujian <sheyujian@me.com>
Committed: Fri May 18 16:16:04 2018 +0800

----------------------------------------------------------------------
 examples/char-rnn/train.py | 2 +-
 python/singa/net.py        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/32b00c06/examples/char-rnn/train.py
----------------------------------------------------------------------
diff --git a/examples/char-rnn/train.py b/examples/char-rnn/train.py
index 240e574..c2440d7 100644
--- a/examples/char-rnn/train.py
+++ b/examples/char-rnn/train.py
@@ -48,7 +48,7 @@ class Data(object):
             train_ratio, split the text file into train and test sets, where
                 train_ratio of the characters are in the train set.
         '''
-        self.raw_data = open(fpath, 'r').read()  # read text file
+        self.raw_data = open(fpath, 'r',encoding='iso-8859-1').read()  # read text file
         chars = list(set(self.raw_data))
         self.vocab_size = len(chars)
         self.char_to_idx = {ch: i for i, ch in enumerate(chars)}

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/32b00c06/python/singa/net.py
----------------------------------------------------------------------
diff --git a/python/singa/net.py b/python/singa/net.py
index 8f5ba97..6dab837 100644
--- a/python/singa/net.py
+++ b/python/singa/net.py
@@ -491,7 +491,7 @@ class FeedForwardNet(object):
                     f = f + '.pickle'
             assert os.path.exists(f), 'file not exists %s w/o .pickle' % f
             with open(f, 'rb') as fd:
-                params = pickle.load(fd)
+                params = pickle.load(fd,encoding='iso-8859-1')
         else:
             print('NOTE: If your model was saved using pickle, '
                   'then set use_pickle=True for loading it')


Mime
View raw message