Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
7f8dd427
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看板
提交
7f8dd427
编写于
1月 14, 2022
作者:
F
felixhjh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add comment
上级
6a75f915
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
6 deletion
+28
-6
examples/Pipeline/PaddleOCR/ocr/web_service.py
examples/Pipeline/PaddleOCR/ocr/web_service.py
+11
-1
python/paddle_serving_app/local_predict.py
python/paddle_serving_app/local_predict.py
+8
-3
python/pipeline/local_service_handler.py
python/pipeline/local_service_handler.py
+4
-2
python/pipeline/operator.py
python/pipeline/operator.py
+5
-0
未找到文件。
examples/Pipeline/PaddleOCR/ocr/web_service.py
浏览文件 @
7f8dd427
...
...
@@ -39,7 +39,12 @@ class DetOp(Op):
"unclip_ratio"
:
1.5
,
"min_size"
:
3
})
"""
when opening tensorrt(configure in config.yml) and each time the input shape
for inferring is different, using this method for configuring tensorrt
dynamic shape to infer in each op model
"""
def
set_dynamic_shape_info
(
self
):
min_input_shape
=
{
"x"
:
[
1
,
3
,
50
,
50
],
...
...
@@ -103,6 +108,11 @@ class RecOp(Op):
self
.
get_rotate_crop_image
=
GetRotateCropImage
()
self
.
sorted_boxes
=
SortedBoxes
()
"""
when opening tensorrt(configure in config.yml) and each time the input shape
for inferring is different, using this method for configuring tensorrt
dynamic shape to infer in each op model
"""
def
set_dynamic_shape_info
(
self
):
min_input_shape
=
{
"x"
:
[
1
,
3
,
32
,
10
],
...
...
python/paddle_serving_app/local_predict.py
浏览文件 @
7f8dd427
...
...
@@ -116,6 +116,8 @@ class LocalPredictor(object):
mkldnn_bf16_op_list: op list accelerated using MKLDNN bf16, None default.
use_feed_fetch_ops: use feed/fetch ops, False default.
use_ascend_cl: run predict on Huawei Ascend, False default
min_subgraph_size: the minimal subgraph size for opening tensorrt to optimize, 3 default
dynamic_shape_info: dict including min_input_shape,max_input_shape, opt_input_shape, {} default
"""
gpu_id
=
int
(
gpu_id
)
client_config
=
"{}/serving_server_conf.prototxt"
.
format
(
model_path
)
...
...
@@ -155,11 +157,12 @@ class LocalPredictor(object):
"use_trt:{}, use_lite:{}, use_xpu:{}, precision:{}, use_calib:{}, "
"use_mkldnn:{}, mkldnn_cache_capacity:{}, mkldnn_op_list:{}, "
"mkldnn_bf16_op_list:{}, use_feed_fetch_ops:{}, "
"use_ascend_cl:{}
"
.
format
(
"use_ascend_cl:{}
, min_subgraph_size:{}, dynamic_shape_info:{}
"
.
format
(
model_path
,
use_gpu
,
gpu_id
,
use_profile
,
thread_num
,
mem_optim
,
ir_optim
,
use_trt
,
use_lite
,
use_xpu
,
precision
,
use_calib
,
use_mkldnn
,
mkldnn_cache_capacity
,
mkldnn_op_list
,
mkldnn_bf16_op_list
,
use_feed_fetch_ops
,
use_ascend_cl
))
mkldnn_bf16_op_list
,
use_feed_fetch_ops
,
use_ascend_cl
,
min_subgraph_size
,
dynamic_shape_info
))
self
.
feed_names_
=
[
var
.
alias_name
for
var
in
model_conf
.
feed_var
]
self
.
fetch_names_
=
[
var
.
alias_name
for
var
in
model_conf
.
fetch_var
]
...
...
@@ -222,7 +225,9 @@ class LocalPredictor(object):
if
len
(
dynamic_shape_info
):
config
.
set_trt_dynamic_shape_info
(
dynamic_shape_info
[
'min_input_shape'
],
dynamic_shape_info
[
'max_input_shape'
],
dynamic_shape_info
[
'opt_input_shape'
])
dynamic_shape_info
[
'min_input_shape'
],
dynamic_shape_info
[
'max_input_shape'
],
dynamic_shape_info
[
'opt_input_shape'
])
# set lite
if
use_lite
:
config
.
enable_lite_engine
(
...
...
python/pipeline/local_service_handler.py
浏览文件 @
7f8dd427
...
...
@@ -182,14 +182,16 @@ class LocalServiceHandler(object):
"mem_optim:{}, ir_optim:{}, use_profile:{}, thread_num:{}, "
"client_type:{}, fetch_names:{}, precision:{}, use_mkldnn:{}, "
"mkldnn_cache_capacity:{}, mkldnn_op_list:{}, "
"mkldnn_bf16_op_list:{}, use_ascend_cl:{}, min_subgraph_size:{}"
.
format
(
"mkldnn_bf16_op_list:{}, use_ascend_cl:{}, min_subgraph_size:{},"
"is_set_dynamic_shape_info:{}"
.
format
(
model_config
,
self
.
_device_name
,
self
.
_use_gpu
,
self
.
_use_trt
,
self
.
_use_lite
,
self
.
_use_xpu
,
device_type
,
self
.
_devices
,
self
.
_mem_optim
,
self
.
_ir_optim
,
self
.
_use_profile
,
self
.
_thread_num
,
self
.
_client_type
,
self
.
_fetch_names
,
self
.
_precision
,
self
.
_use_mkldnn
,
self
.
_mkldnn_cache_capacity
,
self
.
_mkldnn_op_list
,
self
.
_mkldnn_bf16_op_list
,
self
.
_use_ascend_cl
,
self
.
min_subgraph_size
))
self
.
_use_ascend_cl
,
self
.
min_subgraph_sizei
,
bool
(
len
(
self
.
dynamic_shape_info
))))
def
get_fetch_list
(
self
):
return
self
.
_fetch_names
...
...
python/pipeline/operator.py
浏览文件 @
7f8dd427
...
...
@@ -120,6 +120,11 @@ class Op(object):
self
.
set_dynamic_shape_info
()
def
set_dynamic_shape_info
(
self
):
"""
when opening tensorrt(configure in config.yml) and each time the input shape
for inferring is different, using this method for configuring tensorrt
dynamic shape to infer in each op model
"""
pass
# for feed/fetch dict cehck
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录