Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
a0693a5d
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看板
提交
a0693a5d
编写于
2月 23, 2020
作者:
G
guru4elephant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine VLOG
上级
b6ce5fa5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
46 addition
and
51 deletion
+46
-51
core/predictor/src/pdserving.cpp
core/predictor/src/pdserving.cpp
+2
-2
core/sdk-cpp/include/stub_impl.hpp
core/sdk-cpp/include/stub_impl.hpp
+9
-9
core/sdk-cpp/src/abtest.cpp
core/sdk-cpp/src/abtest.cpp
+6
-6
core/sdk-cpp/src/config_manager.cpp
core/sdk-cpp/src/config_manager.cpp
+7
-7
core/sdk-cpp/src/endpoint.cpp
core/sdk-cpp/src/endpoint.cpp
+3
-3
core/sdk-cpp/src/predictor_sdk.cpp
core/sdk-cpp/src/predictor_sdk.cpp
+8
-8
core/sdk-cpp/src/variant.cpp
core/sdk-cpp/src/variant.cpp
+4
-4
python/examples/fit_a_line/local_train.py
python/examples/fit_a_line/local_train.py
+2
-2
python/examples/imdb/local_train.py
python/examples/imdb/local_train.py
+5
-10
未找到文件。
core/predictor/src/pdserving.cpp
浏览文件 @
a0693a5d
...
...
@@ -99,8 +99,8 @@ static void g_change_server_port() {
if
(
read_proto_conf
(
FLAGS_inferservice_path
.
c_str
(),
FLAGS_inferservice_file
.
c_str
(),
&
conf
)
!=
0
)
{
VLOG
(
WARNING
)
<<
"failed to load configure["
<<
FLAGS_inferservice_path
<<
","
<<
FLAGS_inferservice_file
<<
"]."
;
VLOG
(
2
)
<<
"failed to load configure["
<<
FLAGS_inferservice_path
<<
","
<<
FLAGS_inferservice_file
<<
"]."
;
return
;
}
uint32_t
port
=
conf
.
port
();
...
...
core/sdk-cpp/include/stub_impl.hpp
浏览文件 @
a0693a5d
...
...
@@ -35,11 +35,11 @@ int StubImpl<T, C, R, I, O>::initialize(const VariantInfo& var,
}
_gchannel
=
init_channel
(
var
,
filter
);
LOG
(
INFO
)
<<
"Create stub with tag: "
<<
*
tag
<<
", "
<<
*
tag_value
<<
", ep: "
<<
ep
;
VLOG
(
2
)
<<
"Create stub with tag: "
<<
*
tag
<<
", "
<<
*
tag_value
<<
", ep: "
<<
ep
;
}
else
{
_gchannel
=
init_channel
(
var
,
NULL
);
LOG
(
INFO
)
<<
"Create stub without tag, ep "
<<
ep
;
VLOG
(
2
)
<<
"Create stub without tag, ep "
<<
ep
;
}
if
(
!
_gchannel
)
{
...
...
@@ -143,7 +143,7 @@ int StubImpl<T, C, R, I, O>::thrd_initialize() {
return
-
1
;
}
LOG
(
WARNING
)
<<
"Succ thread initialize stub impl!"
;
VLOG
(
2
)
<<
"Succ thread initialize stub impl!"
;
return
0
;
}
...
...
@@ -370,7 +370,7 @@ google::protobuf::RpcChannel* StubImpl<T, C, R, I, O>::init_channel(
// brpc parallel channel
_pchannel
=
init_pchannel
(
_channel
,
_max_channel
,
_package_size
,
chn_options
);
if
(
_pchannel
)
{
LOG
(
INFO
)
<<
"Succ create parallel channel, count: "
<<
_max_channel
;
VLOG
(
2
)
<<
"Succ create parallel channel, count: "
<<
_max_channel
;
return
_pchannel
;
}
...
...
@@ -384,21 +384,21 @@ brpc::ParallelChannel* StubImpl<T, C, R, I, O>::init_pchannel(
uint32_t
package_size
,
const
brpc
::
ChannelOptions
&
options
)
{
if
(
channel_count
<=
1
)
{
// noneed use parallel channel
LOG
(
INFO
)
<<
"channel count <= 1, noneed use pchannel."
;
VLOG
(
2
)
<<
"channel count <= 1, noneed use pchannel."
;
return
NULL
;
}
_pchannel
=
butil
::
get_object
<
brpc
::
ParallelChannel
>
();
if
(
!
_pchannel
)
{
LOG
(
FATAL
)
<<
"Failed get pchannel from object pool"
;
VLOG
(
2
)
<<
"Failed get pchannel from object pool"
;
return
NULL
;
}
brpc
::
ParallelChannelOptions
pchan_options
;
pchan_options
.
timeout_ms
=
options
.
timeout_ms
;
if
(
_pchannel
->
Init
(
&
pchan_options
)
!=
0
)
{
LOG
(
FATAL
)
<<
"Failed init parallel channel with tmo_us: "
<<
pchan_options
.
timeout_ms
;
VLOG
(
2
)
<<
"Failed init parallel channel with tmo_us: "
<<
pchan_options
.
timeout_ms
;
return
NULL
;
}
...
...
core/sdk-cpp/src/abtest.cpp
浏览文件 @
a0693a5d
...
...
@@ -52,9 +52,9 @@ int WeightedRandomRender::initialize(const google::protobuf::Message& conf) {
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ read weights list: "
<<
weights
<<
", count: "
<<
_variant_weight_list
.
size
()
<<
", normalized: "
<<
_normalized_sum
;
VLOG
(
2
)
<<
"Succ read weights list: "
<<
weights
<<
", count: "
<<
_variant_weight_list
.
size
()
<<
", normalized: "
<<
_normalized_sum
;
}
catch
(
std
::
bad_cast
&
e
)
{
LOG
(
ERROR
)
<<
"Failed init WeightedRandomRender"
<<
"from configure, err:"
<<
e
.
what
();
...
...
@@ -87,9 +87,9 @@ Variant* WeightedRandomRender::route(const VariantList& variants) {
for
(
uint32_t
ci
=
0
;
ci
<
cand_size
;
++
ci
)
{
cur_total
+=
_variant_weight_list
[
ci
];
if
(
sample
<
cur_total
)
{
LOG
(
INFO
)
<<
"Sample "
<<
sample
<<
" on "
<<
ci
<<
", _normalized: "
<<
_normalized_sum
<<
", weight: "
<<
_variant_weight_list
[
ci
];
VLOG
(
2
)
<<
"Sample "
<<
sample
<<
" on "
<<
ci
<<
", _normalized: "
<<
_normalized_sum
<<
", weight: "
<<
_variant_weight_list
[
ci
];
return
variants
[
ci
];
}
}
...
...
core/sdk-cpp/src/config_manager.cpp
浏览文件 @
a0693a5d
...
...
@@ -80,8 +80,8 @@ int EndpointConfigManager::load(const std::string& sdk_desc_str) {
LOG
(
ERROR
)
<<
"Failed load configure"
<<
e
.
what
();
return
-
1
;
}
LOG
(
INFO
)
<<
"Success reload endpoint config file, id: "
<<
_current_endpointmap_id
;
VLOG
(
2
)
<<
"Success reload endpoint config file, id: "
<<
_current_endpointmap_id
;
return
0
;
}
...
...
@@ -128,8 +128,8 @@ int EndpointConfigManager::load() {
LOG
(
ERROR
)
<<
"Failed load configure"
<<
e
.
what
();
return
-
1
;
}
LOG
(
INFO
)
<<
"Success reload endpoint config file, id: "
<<
_current_endpointmap_id
;
VLOG
(
2
)
<<
"Success reload endpoint config file, id: "
<<
_current_endpointmap_id
;
return
0
;
}
...
...
@@ -181,8 +181,8 @@ int EndpointConfigManager::init_one_endpoint(const configure::Predictor& conf,
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ load one endpoint, name: "
<<
ep
.
endpoint_name
<<
", count of variants: "
<<
ep
.
vars
.
size
()
<<
"."
;
VLOG
(
2
)
<<
"Succ load one endpoint, name: "
<<
ep
.
endpoint_name
<<
", count of variants: "
<<
ep
.
vars
.
size
()
<<
"."
;
}
catch
(
std
::
exception
&
e
)
{
LOG
(
ERROR
)
<<
"Exception acccurs when load endpoint conf"
<<
", message: "
<<
e
.
what
();
...
...
@@ -258,7 +258,7 @@ int EndpointConfigManager::merge_variant(const VariantInfo& default_var,
int
EndpointConfigManager
::
parse_tag_values
(
SplitParameters
&
split
)
{
split
.
tag_values
.
clear
();
if
(
!
split
.
split_tag
.
init
||
!
split
.
tag_cands_str
.
init
)
{
LOG
(
WARNING
)
<<
"split info not set, skip..."
;
VLOG
(
2
)
<<
"split info not set, skip..."
;
return
0
;
}
...
...
core/sdk-cpp/src/endpoint.cpp
浏览文件 @
a0693a5d
...
...
@@ -35,8 +35,8 @@ int Endpoint::initialize(const EndpointInfo& ep_info) {
return
-
1
;
}
_variant_list
.
push_back
(
var
);
LOG
(
INFO
)
<<
"Succ create variant: "
<<
vi
<<
", endpoint:"
<<
_endpoint_name
;
VLOG
(
2
)
<<
"Succ create variant: "
<<
vi
<<
", endpoint:"
<<
_endpoint_name
;
}
return
0
;
...
...
@@ -51,7 +51,7 @@ int Endpoint::thrd_initialize() {
return
-
1
;
}
}
LOG
(
WARNING
)
<<
"Succ thrd initialize all vars: "
<<
var_size
;
VLOG
(
2
)
<<
"Succ thrd initialize all vars: "
<<
var_size
;
return
0
;
}
...
...
core/sdk-cpp/src/predictor_sdk.cpp
浏览文件 @
a0693a5d
...
...
@@ -25,7 +25,7 @@ int PredictorApi::register_all() {
return
-
1
;
}
LOG
(
WARNING
)
<<
"Succ register all components!"
;
VLOG
(
2
)
<<
"Succ register all components!"
;
return
0
;
}
...
...
@@ -66,8 +66,8 @@ int PredictorApi::create(const std::string & api_desc_str) {
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ create endpoint instance with name: "
<<
ep_info
.
endpoint_name
;
VLOG
(
2
)
<<
"Succ create endpoint instance with name: "
<<
ep_info
.
endpoint_name
;
}
return
0
;
...
...
@@ -101,7 +101,7 @@ int PredictorApi::create(const char* path, const char* file) {
return
-
1
;
}
LOG
(
INFO
)
<<
"endpoint name: "
<<
ep_info
.
endpoint_name
;
VLOG
(
2
)
<<
"endpoint name: "
<<
ep_info
.
endpoint_name
;
std
::
pair
<
std
::
map
<
std
::
string
,
Endpoint
*>::
iterator
,
bool
>
r
=
_endpoints
.
insert
(
std
::
make_pair
(
ep_info
.
endpoint_name
,
ep
));
...
...
@@ -110,8 +110,8 @@ int PredictorApi::create(const char* path, const char* file) {
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ create endpoint instance with name: "
<<
ep_info
.
endpoint_name
;
VLOG
(
2
)
<<
"Succ create endpoint instance with name: "
<<
ep_info
.
endpoint_name
;
}
return
0
;
...
...
@@ -126,7 +126,7 @@ int PredictorApi::thrd_initialize() {
return
-
1
;
}
LOG
(
WARNING
)
<<
"Succ thrd initialize endpoint:"
<<
it
->
first
;
VLOG
(
2
)
<<
"Succ thrd initialize endpoint:"
<<
it
->
first
;
}
return
0
;
}
...
...
@@ -152,7 +152,7 @@ int PredictorApi::thrd_finalize() {
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ thrd finalize endpoint:"
<<
it
->
first
;
VLOG
(
2
)
<<
"Succ thrd finalize endpoint:"
<<
it
->
first
;
}
return
0
;
}
...
...
core/sdk-cpp/src/variant.cpp
浏览文件 @
a0693a5d
...
...
@@ -53,7 +53,7 @@ int Variant::initialize(const EndpointInfo& ep_info,
}
if
(
_stub_map
.
size
()
>
0
)
{
LOG
(
INFO
)
<<
"Initialize variants from VariantInfo"
VLOG
(
2
)
<<
"Initialize variants from VariantInfo"
<<
", stubs count: "
<<
_stub_map
.
size
();
return
0
;
}
...
...
@@ -66,7 +66,7 @@ int Variant::initialize(const EndpointInfo& ep_info,
}
_default_stub
=
stub
;
LOG
(
INFO
)
<<
"Succ create default debug"
;
VLOG
(
2
)
<<
"Succ create default debug"
;
return
0
;
}
...
...
@@ -82,10 +82,10 @@ int Variant::thrd_initialize() {
LOG
(
ERROR
)
<<
"Failed thrd initialize stub: "
<<
iter
->
first
;
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ thrd initialize stub:"
<<
iter
->
first
;
VLOG
(
2
)
<<
"Succ thrd initialize stub:"
<<
iter
->
first
;
}
LOG
(
WARNING
)
<<
"Succ thrd initialize all stubs"
;
VLOG
(
2
)
<<
"Succ thrd initialize all stubs"
;
return
0
;
}
...
...
python/examples/fit_a_line/local_train.py
浏览文件 @
a0693a5d
...
...
@@ -32,5 +32,5 @@ for pass_id in range(30):
fetch_list
=
[
avg_loss
])
serving_io
.
save_model
(
"
serving_server_model"
,
"serving_client_conf
"
,
{
"x"
:
x
},
{
"
y
"
:
y_predict
},
fluid
.
default_main_program
())
"
uci_housing_model"
,
"uci_housing_client
"
,
{
"x"
:
x
},
{
"
price
"
:
y_predict
},
fluid
.
default_main_program
())
python/examples/imdb/local_train.py
浏览文件 @
a0693a5d
...
...
@@ -46,18 +46,17 @@ if __name__ == "__main__":
dataset
.
set_use_var
([
data
,
label
])
pipe_command
=
"python imdb_reader.py"
dataset
.
set_pipe_command
(
pipe_command
)
dataset
.
set_batch_size
(
4
)
dataset
.
set_batch_size
(
128
)
dataset
.
set_filelist
(
filelist
)
dataset
.
set_thread
(
10
)
from
nets
import
cnn
_net
avg_cost
,
acc
,
prediction
=
cnn
_net
(
data
,
label
,
dict_dim
)
from
nets
import
bow
_net
avg_cost
,
acc
,
prediction
=
bow
_net
(
data
,
label
,
dict_dim
)
optimizer
=
fluid
.
optimizer
.
SGD
(
learning_rate
=
0.01
)
optimizer
.
minimize
(
avg_cost
)
exe
=
fluid
.
Executor
(
fluid
.
CPUPlace
())
exe
.
run
(
fluid
.
default_startup_program
())
epochs
=
6
save_dirname
=
"cnn_model"
import
paddle_serving_client.io
as
serving_io
...
...
@@ -67,9 +66,5 @@ if __name__ == "__main__":
logger
.
info
(
"TRAIN --> pass: {}"
.
format
(
i
))
if
i
==
5
:
serving_io
.
save_model
(
"serving_server_model"
,
"serving_client_conf"
,
{
"words"
:
data
,
"label"
:
label
},
{
"cost"
:
avg_cost
,
"acc"
:
acc
,
"prediction"
:
prediction
},
fluid
.
default_main_program
())
{
"words"
:
data
},
{
"prediction"
:
prediction
},
fluid
.
default_main_program
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录