Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
5831f6f4
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看板
提交
5831f6f4
编写于
2月 20, 2020
作者:
G
guru4elephant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more arguments for serve
上级
3527f627
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
28 addition
and
11 deletion
+28
-11
core/general-client/src/elog
core/general-client/src/elog
+0
-1
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+28
-10
未找到文件。
core/general-client/src/elog
已删除
100644 → 0
浏览文件 @
3527f627
make: *** No targets specified and no makefile found. Stop.
python/paddle_serving_server/serve.py
浏览文件 @
5831f6f4
...
@@ -17,8 +17,29 @@ Usage:
...
@@ -17,8 +17,29 @@ Usage:
Example:
Example:
python -m paddle_serving_server.serve model 9292
python -m paddle_serving_server.serve model 9292
"""
"""
import
argparse
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
"serve"
)
parser
.
add_argument
(
"--thread"
,
type
=
int
,
default
=
10
,
help
=
"Concurrency of server"
)
parser
.
add_argument
(
"--model"
,
type
=
str
,
default
=
""
,
help
=
"Model for serving"
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
9292
,
help
=
"Port the server"
)
parser
.
add_argument
(
"--workdir"
,
type
=
str
,
default
=
"workdir"
,
help
=
"Working dir of current service"
)
parser
.
add_argument
(
"--device"
,
type
=
str
,
default
=
"cpu"
,
help
=
"Type of device"
)
return
parser
.
parse_args
()
def
start_standard_model
():
args
=
parse_args
()
thread_num
=
args
.
thread
model
=
args
.
model
port
=
args
.
port
workdir
=
args
.
workdir
device
=
args
.
device
if
model
==
""
:
print
(
"You must specify your serving model"
)
exit
(
-
1
)
def
start_standard_model
(
model_folder
,
port
,
thread_num
):
import
paddle_serving_server
as
serving
import
paddle_serving_server
as
serving
op_maker
=
serving
.
OpMaker
()
op_maker
=
serving
.
OpMaker
()
read_op
=
op_maker
.
create
(
'general_reader'
)
read_op
=
op_maker
.
create
(
'general_reader'
)
...
@@ -30,17 +51,14 @@ def start_standard_model(model_folder, port, thread_num):
...
@@ -30,17 +51,14 @@ def start_standard_model(model_folder, port, thread_num):
op_seq_maker
.
add_op
(
general_infer_op
)
op_seq_maker
.
add_op
(
general_infer_op
)
op_seq_maker
.
add_op
(
general_response_op
)
op_seq_maker
.
add_op
(
general_response_op
)
server
=
Server
()
server
=
serving
.
Server
()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_thread
(
thread_num
)
server
.
set_num_threads
(
thread_num
)
server
.
set_vlog_level
(
0
)
server
.
load_model_config
(
model_folder
)
server
.
load_model_config
(
model
)
port
=
port
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
,
device
=
device
)
server
.
prepare_server
(
workdir
=
"workdir"
,
port
=
port
,
device
=
"cpu"
)
server
.
run_server
()
server
.
run_server
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
!=
4
:
start_standard_model
()
print
(
"{} model_folder port thread"
.
format
(
sys
.
argv
[
0
]))
sys
.
exit
(
0
)
start_standard_model
(
sys
.
argv
[
1
],
int
(
sys
.
argv
[
2
]),
int
(
sys
.
argv
[
3
]))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录