Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
f1ca5fe2
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看板
未验证
提交
f1ca5fe2
编写于
5月 21, 2021
作者:
T
TeslaZhao
提交者:
GitHub
5月 21, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1259 from HexToString/v0.6.0
cherry-pick #1258
上级
fa22074d
2c387d80
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
33 deletion
+39
-33
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+2
-4
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+37
-29
未找到文件。
python/paddle_serving_server/serve.py
浏览文件 @
f1ca5fe2
...
...
@@ -263,10 +263,8 @@ def start_multi_card(args, serving_port=None): # pylint: disable=doc-string-mis
if
"CUDA_VISIBLE_DEVICES"
in
os
.
environ
:
env_gpus
=
os
.
environ
[
"CUDA_VISIBLE_DEVICES"
].
split
(
","
)
for
ids
in
gpus
:
if
int
(
ids
)
>=
len
(
env_gpus
):
print
(
" Max index of gpu_ids out of range, the number of CUDA_VISIBLE_DEVICES is {}."
.
format
(
len
(
env_gpus
)))
if
ids
not
in
env_gpus
:
print
(
"gpu_ids is not in CUDA_VISIBLE_DEVICES."
)
exit
(
-
1
)
else
:
env_gpus
=
[]
...
...
python/paddle_serving_server/web_service.py
浏览文件 @
f1ca5fe2
...
...
@@ -166,6 +166,36 @@ class WebService(object):
def
_launch_rpc_service
(
self
,
service_idx
):
self
.
rpc_service_list
[
service_idx
].
run_server
()
def
create_rpc_config
(
self
):
if
len
(
self
.
gpus
)
==
0
:
# init cpu service
self
.
rpc_service_list
.
append
(
self
.
default_rpc_service
(
self
.
workdir
,
self
.
port_list
[
0
],
-
1
,
thread_num
=
self
.
thread_num
,
mem_optim
=
self
.
mem_optim
,
use_lite
=
self
.
use_lite
,
use_xpu
=
self
.
use_xpu
,
ir_optim
=
self
.
ir_optim
,
precision
=
self
.
precision
,
use_calib
=
self
.
use_calib
))
else
:
for
i
,
gpuid
in
enumerate
(
self
.
gpus
):
self
.
rpc_service_list
.
append
(
self
.
default_rpc_service
(
"{}_{}"
.
format
(
self
.
workdir
,
i
),
self
.
port_list
[
i
],
gpuid
,
thread_num
=
self
.
thread_num
,
mem_optim
=
self
.
mem_optim
,
use_lite
=
self
.
use_lite
,
use_xpu
=
self
.
use_xpu
,
ir_optim
=
self
.
ir_optim
,
precision
=
self
.
precision
,
use_calib
=
self
.
use_calib
))
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
...
...
@@ -183,6 +213,12 @@ class WebService(object):
self
.
port
=
port
self
.
thread_num
=
thread_num
self
.
device
=
device
self
.
precision
=
precision
self
.
use_calib
=
use_calib
self
.
use_lite
=
use_lite
self
.
use_xpu
=
use_xpu
self
.
ir_optim
=
ir_optim
self
.
mem_optim
=
mem_optim
self
.
gpuid
=
gpuid
self
.
port_list
=
[]
default_port
=
12000
...
...
@@ -192,35 +228,6 @@ class WebService(object):
if
len
(
self
.
port_list
)
>
len
(
self
.
gpus
):
break
if
len
(
self
.
gpus
)
==
0
:
# init cpu service
self
.
rpc_service_list
.
append
(
self
.
default_rpc_service
(
self
.
workdir
,
self
.
port_list
[
0
],
-
1
,
thread_num
=
self
.
thread_num
,
mem_optim
=
mem_optim
,
use_lite
=
use_lite
,
use_xpu
=
use_xpu
,
ir_optim
=
ir_optim
,
precision
=
precision
,
use_calib
=
use_calib
))
else
:
for
i
,
gpuid
in
enumerate
(
self
.
gpus
):
self
.
rpc_service_list
.
append
(
self
.
default_rpc_service
(
"{}_{}"
.
format
(
self
.
workdir
,
i
),
self
.
port_list
[
i
],
gpuid
,
thread_num
=
self
.
thread_num
,
mem_optim
=
mem_optim
,
use_lite
=
use_lite
,
use_xpu
=
use_xpu
,
ir_optim
=
ir_optim
,
precision
=
precision
,
use_calib
=
use_calib
))
def
_launch_web_service
(
self
):
gpu_num
=
len
(
self
.
gpus
)
self
.
client
=
Client
()
...
...
@@ -262,6 +269,7 @@ class WebService(object):
print
(
"http://{}:{}/{}/prediction"
.
format
(
localIP
,
self
.
port
,
self
.
name
))
server_pros
=
[]
self
.
create_rpc_config
()
for
i
,
service
in
enumerate
(
self
.
rpc_service_list
):
p
=
Process
(
target
=
self
.
_launch_rpc_service
,
args
=
(
i
,
))
server_pros
.
append
(
p
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录