Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
715153f5
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看板
提交
715153f5
编写于
4月 20, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support change limit sizes of messages
上级
1c7f5159
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
5 deletion
+41
-5
python/paddle_serving_client/__init__.py
python/paddle_serving_client/__init__.py
+1
-1
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+13
-2
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+7
-0
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+18
-2
python/paddle_serving_server_gpu/serve.py
python/paddle_serving_server_gpu/serve.py
+2
-0
未找到文件。
python/paddle_serving_client/__init__.py
浏览文件 @
715153f5
...
...
@@ -111,7 +111,7 @@ class Client(object):
self
.
result_handle_
=
PredictorRes
()
self
.
client_handle_
=
PredictorClient
()
self
.
client_handle_
.
init
(
path
)
read_env_flags
=
[
"profile_client"
,
"profile_server"
]
read_env_flags
=
[
"profile_client"
,
"profile_server"
,
"max_body_size"
]
self
.
client_handle_
.
init_gflags
([
sys
.
argv
[
0
]]
+
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
self
.
feed_names_
=
[
var
.
alias_name
for
var
in
model_conf
.
feed_var
]
...
...
python/paddle_serving_server/__init__.py
浏览文件 @
715153f5
...
...
@@ -89,6 +89,7 @@ class Server(object):
self
.
num_threads
=
4
self
.
port
=
8080
self
.
reload_interval_s
=
10
self
.
max_body_size
=
64
*
1024
*
1024
self
.
module_path
=
os
.
path
.
dirname
(
paddle_serving_server
.
__file__
)
self
.
cur_path
=
os
.
getcwd
()
self
.
use_local_bin
=
False
...
...
@@ -100,6 +101,14 @@ class Server(object):
def
set_num_threads
(
self
,
threads
):
self
.
num_threads
=
threads
def
set_max_body_size
(
self
,
body_size
):
if
body_size
>=
self
.
max_body_size
:
self
.
max_body_size
=
body_size
else
:
print
(
"max_body_size is less than default value, will use default value in service."
)
def
set_port
(
self
,
port
):
self
.
port
=
port
...
...
@@ -292,7 +301,8 @@ class Server(object):
"-resource_file {} "
\
"-workflow_path {} "
\
"-workflow_file {} "
\
"-bthread_concurrency {} "
.
format
(
"-bthread_concurrency {} "
\
"-max_body_size {} "
.
format
(
self
.
bin_path
,
self
.
workdir
,
self
.
infer_service_fn
,
...
...
@@ -304,7 +314,8 @@ class Server(object):
self
.
resource_fn
,
self
.
workdir
,
self
.
workflow_fn
,
self
.
num_threads
)
self
.
num_threads
,
self
.
max_body_size
)
print
(
"Going to Run Command"
)
print
(
command
)
os
.
system
(
command
)
python/paddle_serving_server/serve.py
浏览文件 @
715153f5
...
...
@@ -41,6 +41,11 @@ def parse_args(): # pylint: disable=doc-string-missing
"--device"
,
type
=
str
,
default
=
"cpu"
,
help
=
"Type of device"
)
parser
.
add_argument
(
"--mem_optim"
,
type
=
bool
,
default
=
False
,
help
=
"Memory optimize"
)
parser
.
add_argument
(
"--max_body_size"
,
type
=
int
,
default
=
64
*
1024
*
1024
,
help
=
"Limit sizes of messages"
)
return
parser
.
parse_args
()
...
...
@@ -52,6 +57,7 @@ def start_standard_model(): # pylint: disable=doc-string-missing
workdir
=
args
.
workdir
device
=
args
.
device
mem_optim
=
args
.
mem_optim
max_body_size
=
args
.
max_body_size
if
model
==
""
:
print
(
"You must specify your serving model"
)
...
...
@@ -72,6 +78,7 @@ def start_standard_model(): # pylint: disable=doc-string-missing
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
thread_num
)
server
.
set_memory_optimize
(
mem_optim
)
server
.
set_max_body_size
(
max_body_size
)
server
.
load_model_config
(
model
)
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
,
device
=
device
)
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
715153f5
...
...
@@ -46,6 +46,11 @@ def serve_args():
"--name"
,
type
=
str
,
default
=
"None"
,
help
=
"Default service name"
)
parser
.
add_argument
(
"--mem_optim"
,
type
=
bool
,
default
=
False
,
help
=
"Memory optimize"
)
parser
.
add_argument
(
"--max_body_size"
,
type
=
int
,
default
=
64
*
1024
*
1024
,
help
=
"Limit sizes of messages"
)
return
parser
.
parse_args
()
...
...
@@ -114,6 +119,7 @@ class Server(object):
self
.
num_threads
=
4
self
.
port
=
8080
self
.
reload_interval_s
=
10
self
.
max_body_size
=
64
*
1024
*
1024
self
.
module_path
=
os
.
path
.
dirname
(
paddle_serving_server
.
__file__
)
self
.
cur_path
=
os
.
getcwd
()
self
.
check_cuda
()
...
...
@@ -126,6 +132,14 @@ class Server(object):
def
set_num_threads
(
self
,
threads
):
self
.
num_threads
=
threads
def
set_max_body_size
(
self
,
body_size
):
if
body_size
>=
self
.
max_body_size
:
self
.
max_body_size
=
body_size
else
:
print
(
"max_body_size is less than default value, will use default value in service."
)
def
set_port
(
self
,
port
):
self
.
port
=
port
...
...
@@ -324,7 +338,8 @@ class Server(object):
"-workflow_path {} "
\
"-workflow_file {} "
\
"-bthread_concurrency {} "
\
"-gpuid {} "
.
format
(
"-gpuid {} "
\
"-max_body_size {} "
.
format
(
self
.
bin_path
,
self
.
workdir
,
self
.
infer_service_fn
,
...
...
@@ -337,7 +352,8 @@ class Server(object):
self
.
workdir
,
self
.
workflow_fn
,
self
.
num_threads
,
self
.
gpuid
,)
self
.
gpuid
,
self
.
max_body_size
)
print
(
"Going to Run Comand"
)
print
(
command
)
...
...
python/paddle_serving_server_gpu/serve.py
浏览文件 @
715153f5
...
...
@@ -35,6 +35,7 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss
thread_num
=
args
.
thread
model
=
args
.
model
mem_optim
=
args
.
mem_optim
max_body_size
=
args
.
max_body_size
workdir
=
"{}_{}"
.
format
(
args
.
workdir
,
gpuid
)
if
model
==
""
:
...
...
@@ -56,6 +57,7 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
thread_num
)
server
.
set_memory_optimize
(
mem_optim
)
server
.
set_max_body_size
(
max_body_size
)
server
.
load_model_config
(
model
)
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
,
device
=
device
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录