提交 9064f983 编写于 作者: W wangjiawei04

fix code style

上级 88c5f69c
...@@ -36,6 +36,7 @@ fetch_map = client.predict( ...@@ -36,6 +36,7 @@ fetch_map = client.predict(
"im_info": np.array(list(im.shape[1:]) + [1.0]), "im_info": np.array(list(im.shape[1:]) + [1.0]),
"im_shape": np.array(list(im.shape[1:]) + [1.0]) "im_shape": np.array(list(im.shape[1:]) + [1.0])
}, },
fetch=["multiclass_nms"], batch=False) fetch=["multiclass_nms"],
batch=False)
fetch_map["image"] = sys.argv[3] fetch_map["image"] = sys.argv[3]
postprocess(fetch_map) postprocess(fetch_map)
...@@ -48,13 +48,17 @@ def single_func(idx, resource): ...@@ -48,13 +48,17 @@ def single_func(idx, resource):
for i in range(1000): for i in range(1000):
if args.batch_size >= 1: if args.batch_size >= 1:
feed_batch = [] feed_batch = []
feed = {"words": [], "words.lod":[0]} feed = {"words": [], "words.lod": [0]}
for bi in range(args.batch_size): for bi in range(args.batch_size):
word_ids, label = imdb_dataset.get_words_and_label(dataset[bi]) word_ids, label = imdb_dataset.get_words_and_label(dataset[
feed["words.lod"].append(feed["words.lod"][-1] + len(word_ids)) bi])
feed["words.lod"].append(feed["words.lod"][-1] + len(
word_ids))
feed["words"].extend(word_ids) feed["words"].extend(word_ids)
feed["words"] = np.array(feed["words"]).reshape(len(feed["words"]), 1) feed["words"] = np.array(feed["words"]).reshape(
result = client.predict(feed=feed, fetch=["prediction"], batch=True) len(feed["words"]), 1)
result = client.predict(
feed=feed, fetch=["prediction"], batch=True)
if result is None: if result is None:
raise ("predict failed.") raise ("predict failed.")
else: else:
......
...@@ -35,6 +35,7 @@ fetch_map = client.predict( ...@@ -35,6 +35,7 @@ fetch_map = client.predict(
"image": im, "image": im,
"im_size": np.array(list(im.shape[1:])), "im_size": np.array(list(im.shape[1:])),
}, },
fetch=["save_infer_model/scale_0.tmp_0"], batch=False) fetch=["save_infer_model/scale_0.tmp_0"],
batch=False)
fetch_map["image"] = sys.argv[1] fetch_map["image"] = sys.argv[1]
postprocess(fetch_map) postprocess(fetch_map)
...@@ -843,8 +843,8 @@ class Op(object): ...@@ -843,8 +843,8 @@ class Op(object):
else: else:
self.concurrency_idx = concurrency_idx self.concurrency_idx = concurrency_idx
# init client # init client
self.client = self.init_client( self.client = self.init_client(self._client_config,
self._client_config, self._server_endpoints) self._server_endpoints)
# user defined # user defined
self.init_op() self.init_op()
......
...@@ -23,7 +23,7 @@ info_content = open(info_py, 'r').readlines() ...@@ -23,7 +23,7 @@ info_content = open(info_py, 'r').readlines()
version_line = [ version_line = [
l.strip() for l in info_content if l.startswith('__version__') l.strip() for l in info_content if l.startswith('__version__')
][0] ][0]
exec (version_line) # produce __version__ exec(version_line) # produce __version__
setuptools.setup( setuptools.setup(
name="paddle-gpu-serving", name="paddle-gpu-serving",
......
...@@ -1108,7 +1108,7 @@ function main() { ...@@ -1108,7 +1108,7 @@ function main() {
build_app $TYPE # pwd: /Serving build_app $TYPE # pwd: /Serving
java_run_test $TYPE # pwd: /Serving java_run_test $TYPE # pwd: /Serving
python_run_test $TYPE # pwd: /Serving python_run_test $TYPE # pwd: /Serving
monitor_test $TYPE # pwd: /Serving #monitor_test $TYPE # pwd: /Serving
echo "serving $TYPE part finished as expected." echo "serving $TYPE part finished as expected."
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册