Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
1af86e73
S
Serving
项目概览
PaddlePaddle
/
Serving
接近 2 年 前同步成功
通知
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看板
提交
1af86e73
编写于
7月 09, 2021
作者:
H
HexToString
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix config error
上级
7c81963e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
75 deletion
+57
-75
core/predictor/framework/server.cpp
core/predictor/framework/server.cpp
+0
-1
python/paddle_serving_server/server.py
python/paddle_serving_server/server.py
+53
-69
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+4
-5
未找到文件。
core/predictor/framework/server.cpp
浏览文件 @
1af86e73
...
...
@@ -96,7 +96,6 @@ int ServerManager::start_and_wait() {
LOG
(
ERROR
)
<<
"Failed to start Paddle Inference Server"
;
return
-
1
;
}
LOG
(
WARNING
)
<<
"Finsh start C++ PaddleServing."
;
_server
.
RunUntilAskedToQuit
();
ServerManager
::
stop_reloader
();
...
...
python/paddle_serving_server/server.py
浏览文件 @
1af86e73
...
...
@@ -41,6 +41,8 @@ from multiprocessing import Pool, Process
from
concurrent
import
futures
# The whole file is about to be discarded.
# We will use default config-file to start C++Server.
class
Server
(
object
):
def
__init__
(
self
):
"""
...
...
@@ -172,8 +174,7 @@ class Server(object):
if
isinstance
(
gpuid
,
int
):
self
.
gpuid
=
str
(
gpuid
)
elif
isinstance
(
gpuid
,
list
):
gpu_list
=
[
str
(
x
)
for
x
in
gpuid
]
self
.
gpuid
=
","
.
join
(
gpu_list
)
self
.
gpuid
=
[
str
(
x
)
for
x
in
gpuid
]
else
:
self
.
gpuid
=
gpuid
...
...
@@ -200,8 +201,14 @@ class Server(object):
self
.
model_toolkit_conf
=
[]
self
.
device
=
device
# Generally, self.gpuid = str[] or str.
# such as "0" or ["0"] or ["0,1"] or ["0,1" , "1,2"]
if
isinstance
(
self
.
gpuid
,
str
):
self
.
gpuid
=
[
self
.
gpuid
]
# when len(self.gpuid) means no gpuid is specified.
# if self.device == "gpu" or self.use_trt:
# we assume you forget to set gpuid, so set gpuid = ['0'];
if
len
(
self
.
gpuid
)
==
0
:
if
self
.
device
==
"gpu"
or
self
.
use_trt
:
self
.
gpuid
.
append
(
"0"
)
...
...
@@ -240,8 +247,6 @@ class Server(object):
engine
.
use_lite
=
self
.
use_lite
engine
.
use_xpu
=
self
.
use_xpu
engine
.
use_gpu
=
False
if
self
.
device
==
"gpu"
or
self
.
use_trt
:
engine
.
use_gpu
=
True
if
len
(
self
.
gpuid
)
==
0
:
raise
ValueError
(
"CPU: self.gpuid = -1, GPU: must set it "
)
...
...
@@ -249,6 +254,18 @@ class Server(object):
for
ids
in
op_gpu_list
:
engine
.
gpu_ids
.
extend
([
int
(
ids
)])
if
self
.
device
==
"gpu"
or
self
.
use_trt
:
engine
.
use_gpu
=
True
# this is for Mixed use of GPU and CPU
# if model-1 use GPU and set the device="gpu"
# but gpuid[1] = "-1" which means use CPU in Model-2
# so config about GPU should be False.
if
len
(
op_gpu_list
)
==
1
:
if
int
(
op_gpu_list
[
0
])
==
-
1
:
engine
.
use_gpu
=
False
engine
.
gpu_multi_stream
=
False
engine
.
use_trt
=
False
if
os
.
path
.
exists
(
'{}/__params__'
.
format
(
model_config_path
)):
engine
.
combined_model
=
True
else
:
...
...
@@ -540,71 +557,38 @@ class Server(object):
else
:
print
(
"Use local bin : {}"
.
format
(
self
.
bin_path
))
#self.check_cuda()
# Todo: merge CPU and GPU code, remove device to model_toolkit
if
self
.
device
==
"cpu"
or
self
.
device
==
"arm"
:
command
=
"{} "
\
"-enable_model_toolkit "
\
"-inferservice_path {} "
\
"-inferservice_file {} "
\
"-max_concurrency {} "
\
"-num_threads {} "
\
"-port {} "
\
"-precision {} "
\
"-use_calib {} "
\
"-reload_interval_s {} "
\
"-resource_path {} "
\
"-resource_file {} "
\
"-workflow_path {} "
\
"-workflow_file {} "
\
"-bthread_concurrency {} "
\
"-max_body_size {} "
.
format
(
self
.
bin_path
,
self
.
workdir
,
self
.
infer_service_fn
,
self
.
max_concurrency
,
self
.
num_threads
,
self
.
port
,
self
.
precision
,
self
.
use_calib
,
self
.
reload_interval_s
,
self
.
workdir
,
self
.
resource_fn
,
self
.
workdir
,
self
.
workflow_fn
,
self
.
num_threads
,
self
.
max_body_size
)
else
:
command
=
"{} "
\
"-enable_model_toolkit "
\
"-inferservice_path {} "
\
"-inferservice_file {} "
\
"-max_concurrency {} "
\
"-num_threads {} "
\
"-port {} "
\
"-precision {} "
\
"-use_calib {} "
\
"-reload_interval_s {} "
\
"-resource_path {} "
\
"-resource_file {} "
\
"-workflow_path {} "
\
"-workflow_file {} "
\
"-bthread_concurrency {} "
\
"-max_body_size {} "
.
format
(
self
.
bin_path
,
self
.
workdir
,
self
.
infer_service_fn
,
self
.
max_concurrency
,
self
.
num_threads
,
self
.
port
,
self
.
precision
,
self
.
use_calib
,
self
.
reload_interval_s
,
self
.
workdir
,
self
.
resource_fn
,
self
.
workdir
,
self
.
workflow_fn
,
self
.
num_threads
,
self
.
max_body_size
)
command
=
"{} "
\
"-enable_model_toolkit "
\
"-inferservice_path {} "
\
"-inferservice_file {} "
\
"-max_concurrency {} "
\
"-num_threads {} "
\
"-port {} "
\
"-precision {} "
\
"-use_calib {} "
\
"-reload_interval_s {} "
\
"-resource_path {} "
\
"-resource_file {} "
\
"-workflow_path {} "
\
"-workflow_file {} "
\
"-bthread_concurrency {} "
\
"-max_body_size {} "
.
format
(
self
.
bin_path
,
self
.
workdir
,
self
.
infer_service_fn
,
self
.
max_concurrency
,
self
.
num_threads
,
self
.
port
,
self
.
precision
,
self
.
use_calib
,
self
.
reload_interval_s
,
self
.
workdir
,
self
.
resource_fn
,
self
.
workdir
,
self
.
workflow_fn
,
self
.
num_threads
,
self
.
max_body_size
)
print
(
"Going to Run Comand"
)
print
(
command
)
...
...
python/paddle_serving_server/web_service.py
浏览文件 @
1af86e73
...
...
@@ -108,8 +108,7 @@ class WebService(object):
if
isinstance
(
gpus
,
int
):
self
.
gpus
=
str
(
gpus
)
elif
isinstance
(
gpus
,
list
):
gpu_list
=
[
str
(
x
)
for
x
in
gpus
]
self
.
gpus
=
","
.
join
(
gpu_list
)
self
.
gpus
=
[
str
(
x
)
for
x
in
gpus
]
else
:
self
.
gpus
=
gpus
...
...
@@ -261,8 +260,7 @@ class WebService(object):
if
isinstance
(
gpuid
,
int
):
self
.
gpus
=
str
(
gpuid
)
elif
isinstance
(
gpuid
,
list
):
gpu_list
=
[
str
(
x
)
for
x
in
gpuid
]
self
.
gpus
=
","
.
join
(
gpu_list
)
self
.
gpus
=
[
str
(
x
)
for
x
in
gpuid
]
else
:
self
.
gpus
=
gpuid
...
...
@@ -363,7 +361,8 @@ class WebService(object):
# default self.gpus = [0].
if
len
(
self
.
gpus
)
==
0
:
self
.
gpus
.
append
(
0
)
# right now, local Predictor only support 1 card.
# no matter how many gpu_id is in gpus, we only use the first one.
gpu_id
=
(
self
.
gpus
[
0
].
split
(
","
))[
0
]
self
.
client
.
load_model_config
(
self
.
server_config_dir_paths
[
0
],
use_gpu
=
True
,
gpu_id
=
gpu_id
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录