Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
1ad96012
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1ad96012
编写于
2月 17, 2020
作者:
D
Dong Daxiang
提交者:
GitHub
2月 17, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #177 from MRXLT/general-server-v1
bug fix && add debug for batch_predict
上级
e1ee71cd
f369d66a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
6 deletion
+18
-6
core/general-client/src/general_model.cpp
core/general-client/src/general_model.cpp
+9
-2
python/paddle_serving_client/__init__.py
python/paddle_serving_client/__init__.py
+8
-3
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+1
-1
未找到文件。
core/general-client/src/general_model.cpp
浏览文件 @
1ad96012
...
...
@@ -214,7 +214,7 @@ std::vector<std::vector<std::vector<float>>> PredictorClient::batch_predict(
if
(
fetch_name
.
size
()
==
0
)
{
return
fetch_result_batch
;
}
fetch_result_batch
.
resize
(
batch_size
);
fetch_result_batch
.
resize
(
batch_size
+
1
);
int
fetch_name_num
=
fetch_name
.
size
();
for
(
int
bi
=
0
;
bi
<
batch_size
;
bi
++
)
{
fetch_result_batch
[
bi
].
resize
(
fetch_name_num
);
...
...
@@ -226,6 +226,9 @@ std::vector<std::vector<std::vector<float>>> PredictorClient::batch_predict(
VLOG
(
2
)
<<
"float feed name size: "
<<
float_feed_name
.
size
();
VLOG
(
2
)
<<
"int feed name size: "
<<
int_feed_name
.
size
();
Request
req
;
for
(
auto
&
name
:
fetch_name
)
{
req
.
add_fetch_var_names
(
name
);
}
//
for
(
int
bi
=
0
;
bi
<
batch_size
;
bi
++
)
{
VLOG
(
2
)
<<
"prepare batch "
<<
bi
;
...
...
@@ -240,7 +243,7 @@ std::vector<std::vector<std::vector<float>>> PredictorClient::batch_predict(
for
(
auto
&
name
:
int_feed_name
)
{
tensor_vec
.
push_back
(
inst
->
add_tensor_array
());
}
VLOG
(
2
)
<<
"batch ["
<<
bi
<<
"] int_feed_name and float_feed_name"
<<
"prepared"
;
int
vec_idx
=
0
;
...
...
@@ -305,6 +308,10 @@ std::vector<std::vector<std::vector<float>>> PredictorClient::batch_predict(
}
}
}
//last index for infer time
fetch_result_batch
[
batch_size
].
resize
(
1
);
fetch_result_batch
[
batch_size
][
0
].
resize
(
1
);
fetch_result_batch
[
batch_size
][
0
][
0
]
=
res
.
mean_infer_us
();
}
return
fetch_result_batch
;
...
...
python/paddle_serving_client/__init__.py
浏览文件 @
1ad96012
...
...
@@ -147,7 +147,7 @@ class Client(object):
return
result_map
def
batch_predict
(
self
,
feed_batch
=
[],
fetch
=
[]):
def
batch_predict
(
self
,
feed_batch
=
[],
fetch
=
[]
,
debug
=
False
):
int_slot_batch
=
[]
float_slot_batch
=
[]
int_feed_names
=
[]
...
...
@@ -181,13 +181,18 @@ class Client(object):
fetch_names
)
result_map_batch
=
[]
for
result
in
result_batch
:
for
result
in
result_batch
[:
-
1
]
:
result_map
=
{}
for
i
,
name
in
enumerate
(
fetch_names
):
result_map
[
name
]
=
result
[
i
]
result_map_batch
.
append
(
result_map
)
return
result_map_batch
infer_time
=
result_batch
[
-
1
][
0
][
0
]
if
debug
:
return
result_map_batch
,
infer_time
else
:
return
result_map_batch
def
release
(
self
):
self
.
client_handle_
.
destroy_predictor
()
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
1ad96012
...
...
@@ -17,7 +17,7 @@ from .proto import server_configure_pb2 as server_sdk
from
.proto
import
general_model_config_pb2
as
m_config
import
google.protobuf.text_format
import
tarfile
import
paddle_serving_server
as
paddle_serving_server
import
paddle_serving_server
_gpu
as
paddle_serving_server
from
version
import
serving_server_version
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录