Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
d2906933
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,发现更多精彩内容 >>
提交
d2906933
编写于
1月 19, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize general server config
上级
1dd2066f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
40 deletion
+15
-40
core/configure/proto/general_model_config.proto
core/configure/proto/general_model_config.proto
+2
-4
core/predictor/framework/resource.cpp
core/predictor/framework/resource.cpp
+4
-7
examples/demo-serving/conf/general_model.prototxt
examples/demo-serving/conf/general_model.prototxt
+9
-19
examples/demo-serving/op/general_model_op.cpp
examples/demo-serving/op/general_model_op.cpp
+0
-10
未找到文件。
core/configure/proto/general_model_config.proto
浏览文件 @
d2906933
...
@@ -15,17 +15,15 @@
...
@@ -15,17 +15,15 @@
syntax
=
"proto2"
;
syntax
=
"proto2"
;
package
baidu
.
paddle_serving.configure
;
package
baidu
.
paddle_serving.configure
;
message
Shape
{
repeated
int32
shape
=
1
;
};
message
FeedVar
{
message
FeedVar
{
required
string
name
=
1
;
required
string
name
=
1
;
required
bool
is_lod_tensor
=
2
;
required
bool
is_lod_tensor
=
2
;
required
int32
feed_type
=
3
;
required
int32
feed_type
=
3
;
re
quired
Shape
feed_
shape
=
4
;
re
peated
int32
shape
=
4
;
}
}
message
FetchVar
{
message
FetchVar
{
required
string
name
=
1
;
required
string
name
=
1
;
re
quired
Shape
fetch_
shape
=
2
;
re
peated
int32
shape
=
2
;
}
}
message
GeneralModelConfig
{
message
GeneralModelConfig
{
repeated
FeedVar
feed_var
=
1
;
repeated
FeedVar
feed_var
=
1
;
...
...
core/predictor/framework/resource.cpp
浏览文件 @
d2906933
...
@@ -23,7 +23,6 @@ namespace predictor {
...
@@ -23,7 +23,6 @@ namespace predictor {
using
configure
::
ResourceConf
;
using
configure
::
ResourceConf
;
using
configure
::
GeneralModelConfig
;
using
configure
::
GeneralModelConfig
;
using
configure
::
Shape
;
using
rec
::
mcube
::
CubeAPI
;
using
rec
::
mcube
::
CubeAPI
;
// __thread bool p_thread_initialized = false;
// __thread bool p_thread_initialized = false;
...
@@ -198,9 +197,8 @@ int Resource::general_model_initialize(const std::string& path,
...
@@ -198,9 +197,8 @@ int Resource::general_model_initialize(const std::string& path,
}
else
{
}
else
{
_config
->
_capacity
[
i
]
=
1
;
_config
->
_capacity
[
i
]
=
1
;
_config
->
_is_lod_feed
[
i
]
=
false
;
_config
->
_is_lod_feed
[
i
]
=
false
;
for
(
int
j
=
0
;
j
<
model_config
.
feed_var
(
i
).
feed_shape
().
shape_size
();
for
(
int
j
=
0
;
j
<
model_config
.
feed_var
(
i
).
shape_size
();
++
j
)
{
++
j
)
{
int32_t
dim
=
model_config
.
feed_var
(
i
).
shape
(
j
);
int32_t
dim
=
model_config
.
feed_var
(
i
).
feed_shape
().
shape
(
j
);
_config
->
_feed_shape
[
i
].
push_back
(
dim
);
_config
->
_feed_shape
[
i
].
push_back
(
dim
);
_config
->
_capacity
[
i
]
*=
dim
;
_config
->
_capacity
[
i
]
*=
dim
;
}
}
...
@@ -212,9 +210,8 @@ int Resource::general_model_initialize(const std::string& path,
...
@@ -212,9 +210,8 @@ int Resource::general_model_initialize(const std::string& path,
_config
->
_fetch_shape
.
resize
(
fetch_var_num
);
_config
->
_fetch_shape
.
resize
(
fetch_var_num
);
for
(
int
i
=
0
;
i
<
fetch_var_num
;
++
i
)
{
for
(
int
i
=
0
;
i
<
fetch_var_num
;
++
i
)
{
_config
->
_fetch_name
[
i
]
=
model_config
.
fetch_var
(
i
).
name
();
_config
->
_fetch_name
[
i
]
=
model_config
.
fetch_var
(
i
).
name
();
for
(
int
j
=
0
;
j
<
model_config
.
fetch_var
(
i
).
fetch_shape
().
shape_size
();
for
(
int
j
=
0
;
j
<
model_config
.
fetch_var
(
i
).
shape_size
();
++
j
)
{
++
j
)
{
int
dim
=
model_config
.
fetch_var
(
i
).
shape
(
j
);
int
dim
=
model_config
.
fetch_var
(
i
).
fetch_shape
().
shape
(
j
);
_config
->
_fetch_shape
[
i
].
push_back
(
dim
);
_config
->
_fetch_shape
[
i
].
push_back
(
dim
);
}
}
}
}
...
...
examples/demo-serving/conf/general_model.prototxt
浏览文件 @
d2906933
feed_var {
feed_var {
name: "words"
name: "words"
is_lod_tensor:
fals
e
is_lod_tensor:
tru
e
feed_type: 0
feed_type: 0
feed_shape {
shape: -1
shape: -1
}
}
}
feed_var {
feed_var {
name: "label"
name: "label"
is_lod_tensor: false
is_lod_tensor: false
feed_type: 0
feed_type: 0
feed_shape {
shape: 1
shape: 1
}
}
}
fetch_var {
fetch_var {
name: "mean_0.tmp_0"
name: "cost"
fetch_shape {
shape: 1
shape: 1
}
}
}
fetch_var {
fetch_var {
name: "accuracy_0.tmp_0"
name: "acc"
fetch_shape {
shape: 1
shape: 1
}
}
}
fetch_var {
fetch_var {
name: "fc_1.tmp_2"
name: "prediction"
fetch_shape {
shape: 2
shape: 1
}
}
}
examples/demo-serving/op/general_model_op.cpp
浏览文件 @
d2906933
...
@@ -48,16 +48,6 @@ int GeneralModelOp::inference() {
...
@@ -48,16 +48,6 @@ int GeneralModelOp::inference() {
std
::
vector
<
int
>
elem_size
;
std
::
vector
<
int
>
elem_size
;
std
::
vector
<
int
>
capacity
;
std
::
vector
<
int
>
capacity
;
// config
LOG
(
INFO
)
<<
"start to call load general model_conf op"
;
baidu
::
paddle_serving
::
predictor
::
Resource
&
resource
=
baidu
::
paddle_serving
::
predictor
::
Resource
::
instance
();
LOG
(
INFO
)
<<
"get resource pointer done."
;
std
::
shared_ptr
<
PaddleGeneralModelConfig
>
model_config
=
resource
.
get_general_model_config
();
LOG
(
INFO
)
<<
"get general model config pointer done."
;
resource
.
print_general_model_config
(
model_config
);
// infer
// infer
if
(
batch_size
>
0
)
{
if
(
batch_size
>
0
)
{
int
var_num
=
req
->
insts
(
0
).
tensor_array_size
();
int
var_num
=
req
->
insts
(
0
).
tensor_array_size
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录