Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
2aadaa10
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
185
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2aadaa10
编写于
8月 06, 2020
作者:
B
barriery
提交者:
GitHub
8月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #24 from barrierye/pipeling-log
add log_id to proto; TODO: recompile pdcodegen
上级
777f4dce
3c500fa3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
27 addition
and
11 deletion
+27
-11
core/general-client/include/general_model.h
core/general-client/include/general_model.h
+4
-2
core/general-client/src/general_model.cpp
core/general-client/src/general_model.cpp
+8
-2
core/general-client/src/pybind_general_model.cpp
core/general-client/src/pybind_general_model.cpp
+8
-4
core/general-server/proto/general_model_service.proto
core/general-server/proto/general_model_service.proto
+1
-0
core/pdcodegen/src/pdcodegen.cpp
core/pdcodegen/src/pdcodegen.cpp
+2
-0
core/sdk-cpp/proto/general_model_service.proto
core/sdk-cpp/proto/general_model_service.proto
+1
-0
python/paddle_serving_client/__init__.py
python/paddle_serving_client/__init__.py
+3
-3
未找到文件。
core/general-client/include/general_model.h
浏览文件 @
2aadaa10
...
...
@@ -227,7 +227,8 @@ class PredictorClient {
const
std
::
vector
<
std
::
vector
<
int
>>&
int_shape
,
const
std
::
vector
<
std
::
string
>&
fetch_name
,
PredictorRes
&
predict_res_batch
,
// NOLINT
const
int
&
pid
);
const
int
&
pid
,
const
uint64_t
log_id
);
int
numpy_predict
(
const
std
::
vector
<
std
::
vector
<
py
::
array_t
<
float
>>>&
float_feed_batch
,
...
...
@@ -238,7 +239,8 @@ class PredictorClient {
const
std
::
vector
<
std
::
vector
<
int
>>&
int_shape
,
const
std
::
vector
<
std
::
string
>&
fetch_name
,
PredictorRes
&
predict_res_batch
,
// NOLINT
const
int
&
pid
);
const
int
&
pid
,
const
uint64_t
log_id
);
private:
PredictorApi
_api
;
...
...
core/general-client/src/general_model.cpp
浏览文件 @
2aadaa10
...
...
@@ -144,7 +144,8 @@ int PredictorClient::batch_predict(
const
std
::
vector
<
std
::
vector
<
int
>>
&
int_shape
,
const
std
::
vector
<
std
::
string
>
&
fetch_name
,
PredictorRes
&
predict_res_batch
,
const
int
&
pid
)
{
const
int
&
pid
,
const
uint64_t
log_id
)
{
int
batch_size
=
std
::
max
(
float_feed_batch
.
size
(),
int_feed_batch
.
size
());
predict_res_batch
.
clear
();
...
...
@@ -162,6 +163,8 @@ int PredictorClient::batch_predict(
VLOG
(
2
)
<<
"int feed name size: "
<<
int_feed_name
.
size
();
VLOG
(
2
)
<<
"max body size : "
<<
brpc
::
fLU64
::
FLAGS_max_body_size
;
Request
req
;
req
.
set_log_id
(
log_id
);
VLOG
(
2
)
<<
"(logid="
<<
req
.
log_id
()
<<
")"
;
for
(
auto
&
name
:
fetch_name
)
{
req
.
add_fetch_var_names
(
name
);
}
...
...
@@ -356,7 +359,8 @@ int PredictorClient::numpy_predict(
const
std
::
vector
<
std
::
vector
<
int
>>
&
int_shape
,
const
std
::
vector
<
std
::
string
>
&
fetch_name
,
PredictorRes
&
predict_res_batch
,
const
int
&
pid
)
{
const
int
&
pid
,
const
uint64_t
log_id
)
{
int
batch_size
=
std
::
max
(
float_feed_batch
.
size
(),
int_feed_batch
.
size
());
VLOG
(
2
)
<<
"batch size: "
<<
batch_size
;
predict_res_batch
.
clear
();
...
...
@@ -374,6 +378,8 @@ int PredictorClient::numpy_predict(
VLOG
(
2
)
<<
"int feed name size: "
<<
int_feed_name
.
size
();
VLOG
(
2
)
<<
"max body size : "
<<
brpc
::
fLU64
::
FLAGS_max_body_size
;
Request
req
;
req
.
set_log_id
(
log_id
);
VLOG
(
2
)
<<
"(logid="
<<
req
.
log_id
()
<<
")"
;
for
(
auto
&
name
:
fetch_name
)
{
req
.
add_fetch_var_names
(
name
);
}
...
...
core/general-client/src/pybind_general_model.cpp
浏览文件 @
2aadaa10
...
...
@@ -107,7 +107,8 @@ PYBIND11_MODULE(serving_client, m) {
const
std
::
vector
<
std
::
vector
<
int
>>
&
int_shape
,
const
std
::
vector
<
std
::
string
>
&
fetch_name
,
PredictorRes
&
predict_res_batch
,
const
int
&
pid
)
{
const
int
&
pid
,
const
uint64_t
log_id
)
{
return
self
.
batch_predict
(
float_feed_batch
,
float_feed_name
,
float_shape
,
...
...
@@ -116,7 +117,8 @@ PYBIND11_MODULE(serving_client, m) {
int_shape
,
fetch_name
,
predict_res_batch
,
pid
);
pid
,
log_id
);
},
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"numpy_predict"
,
...
...
@@ -131,7 +133,8 @@ PYBIND11_MODULE(serving_client, m) {
const
std
::
vector
<
std
::
vector
<
int
>>
&
int_shape
,
const
std
::
vector
<
std
::
string
>
&
fetch_name
,
PredictorRes
&
predict_res_batch
,
const
int
&
pid
)
{
const
int
&
pid
,
const
uint64_t
log_id
)
{
return
self
.
numpy_predict
(
float_feed_batch
,
float_feed_name
,
float_shape
,
...
...
@@ -140,7 +143,8 @@ PYBIND11_MODULE(serving_client, m) {
int_shape
,
fetch_name
,
predict_res_batch
,
pid
);
pid
,
log_id
);
},
py
::
call_guard
<
py
::
gil_scoped_release
>
());
}
...
...
core/general-server/proto/general_model_service.proto
浏览文件 @
2aadaa10
...
...
@@ -37,6 +37,7 @@ message Request {
repeated
FeedInst
insts
=
1
;
repeated
string
fetch_var_names
=
2
;
optional
bool
profile_server
=
3
[
default
=
false
];
required
uint64
log_id
=
4
[
default
=
0
];
};
message
Response
{
...
...
core/pdcodegen/src/pdcodegen.cpp
浏览文件 @
2aadaa10
...
...
@@ -280,6 +280,7 @@ class PdsCodeGenerator : public CodeGenerator {
" baidu::rpc::ClosureGuard done_guard(done);
\n
"
" baidu::rpc::Controller* cntl =
\n
"
" static_cast<baidu::rpc::Controller*>(cntl_base);
\n
"
" cntl->set_log_id(request->log_id());
\n
"
" ::baidu::paddle_serving::predictor::InferService* svr =
\n
"
" "
"::baidu::paddle_serving::predictor::InferServiceManager::instance("
...
...
@@ -317,6 +318,7 @@ class PdsCodeGenerator : public CodeGenerator {
" baidu::rpc::ClosureGuard done_guard(done);
\n
"
" baidu::rpc::Controller* cntl =
\n
"
" static_cast<baidu::rpc::Controller*>(cntl_base);
\n
"
" cntl->set_log_id(request->log_id());
\n
"
" ::baidu::paddle_serving::predictor::InferService* svr =
\n
"
" "
"::baidu::paddle_serving::predictor::InferServiceManager::instance("
...
...
core/sdk-cpp/proto/general_model_service.proto
浏览文件 @
2aadaa10
...
...
@@ -37,6 +37,7 @@ message Request {
repeated
FeedInst
insts
=
1
;
repeated
string
fetch_var_names
=
2
;
optional
bool
profile_server
=
3
[
default
=
false
];
required
uint64
log_id
=
4
[
default
=
0
];
};
message
Response
{
...
...
python/paddle_serving_client/__init__.py
浏览文件 @
2aadaa10
...
...
@@ -233,7 +233,7 @@ class Client(object):
# key))
pass
def
predict
(
self
,
feed
=
None
,
fetch
=
None
,
need_variant_tag
=
False
):
def
predict
(
self
,
feed
=
None
,
fetch
=
None
,
need_variant_tag
=
False
,
log_id
=
0
):
self
.
profile_
.
record
(
'py_prepro_0'
)
if
feed
is
None
or
fetch
is
None
:
...
...
@@ -319,12 +319,12 @@ class Client(object):
res
=
self
.
client_handle_
.
numpy_predict
(
float_slot_batch
,
float_feed_names
,
float_shape
,
int_slot_batch
,
int_feed_names
,
int_shape
,
fetch_names
,
result_batch_handle
,
self
.
pid
)
self
.
pid
,
log_id
)
elif
self
.
has_numpy_input
==
False
:
res
=
self
.
client_handle_
.
batch_predict
(
float_slot_batch
,
float_feed_names
,
float_shape
,
int_slot_batch
,
int_feed_names
,
int_shape
,
fetch_names
,
result_batch_handle
,
self
.
pid
)
self
.
pid
,
log_id
)
else
:
raise
ValueError
(
"Please make sure the inputs are all in list type or all in numpy.array type"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录