提交 e8c022d2 编写于 作者: B barrierye

fix benchmark_batch.py

上级 213a8fff
...@@ -53,15 +53,14 @@ def single_func(idx, resource): ...@@ -53,15 +53,14 @@ def single_func(idx, resource):
if args.batch_size >= 1: if args.batch_size >= 1:
feed_batch = [] feed_batch = []
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]) feed_batch.append({"words": dataset[bi]})
feed_batch.append({"words": word_ids})
r = requests.post( r = requests.post(
"http://{}/imdb/prediction".format(args.endpoint), "http://{}/imdb/prediction".format(args.endpoint),
json={"feed": feed_batch, json={"feed": feed_batch,
"fetch": ["prediction"]}) "fetch": ["prediction"]})
if r.status_code != 200: if r.status_code != 200:
print('HTTP status code -ne 200') print('HTTP status code -ne 200')
exit(1) raise ("predict failed.")
else: else:
print("unsupport batch size {}".format(args.batch_size)) print("unsupport batch size {}".format(args.batch_size))
end = time.time() end = time.time()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册