From 01eec0af91a5dffc4cdbf462f48f4effe8fc4db9 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Wed, 22 Aug 2018 23:00:08 +0800 Subject: [PATCH] Fix flowers dataset reading problem --- python/paddle/dataset/flowers.py | 5 ++++- python/paddle/fluid/tests/unittests/CMakeLists.txt | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/paddle/dataset/flowers.py b/python/paddle/dataset/flowers.py index ce0cd6009a9..8c9c721b33c 100644 --- a/python/paddle/dataset/flowers.py +++ b/python/paddle/dataset/flowers.py @@ -120,7 +120,10 @@ def reader_creator(data_file, file = file.strip() batch = None with open(file, 'rb') as f: - batch = pickle.loads(f.read()) + if six.PY2: + batch = pickle.load(f) + else: + batch = pickle.load(f, encoding='bytes') data = batch['data'] labels = batch['label'] for sample, label in zip(data, batch['label']): diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index ae13d7ff31b..e7dd85ef5c3 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -64,7 +64,6 @@ if(WITH_DISTRIBUTE) endif() py_test_modules(test_parallel_executor_crf MODULES test_parallel_executor_crf SERIAL) py_test_modules(test_parallel_executor_fetch_feed MODULES test_parallel_executor_fetch_feed SERIAL) -set_tests_properties(test_parallel_executor_fetch_feed PROPERTIES TIMEOUT 500) py_test_modules(test_dist_transformer MODULES test_dist_transformer SERIAL) py_test_modules(test_dist_se_resnext MODULES test_dist_se_resnext SERIAL) py_test_modules(test_parallel_executor_transformer MODULES test_parallel_executor_transformer SERIAL) -- GitLab