Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
2f3f9bb6
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看板
提交
2f3f9bb6
编写于
7月 29, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize memory
上级
ab34adee
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
41 addition
and
18 deletion
+41
-18
README.md
README.md
+1
-1
README_CN.md
README_CN.md
+1
-1
cmake/external/brpc.cmake
cmake/external/brpc.cmake
+2
-2
doc/FAQ.md
doc/FAQ.md
+0
-3
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+2
-2
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+10
-1
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+3
-3
python/paddle_serving_server_gpu/serve.py
python/paddle_serving_server_gpu/serve.py
+1
-1
python/paddle_serving_server_gpu/web_service.py
python/paddle_serving_server_gpu/web_service.py
+21
-4
未找到文件。
README.md
浏览文件 @
2f3f9bb6
...
...
@@ -124,7 +124,7 @@ python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --po
|
`port`
| int |
`9292`
| Exposed port of current service to users|
|
`name`
| str |
`""`
| Service name, can be used to generate HTTP request url |
|
`model`
| str |
`""`
| Path of paddle model directory to be served |
|
`mem_optim
`
| - | - | En
able memory / graphic memory optimization |
|
`mem_optim
_off`
| - | - | Dis
able memory / graphic memory optimization |
|
`ir_optim`
| - | - | Enable analysis and optimization of calculation graph |
|
`use_mkl`
(Only for cpu version) | - | - | Run inference with MKL |
...
...
README_CN.md
浏览文件 @
2f3f9bb6
...
...
@@ -120,7 +120,7 @@ python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --po
| `
port
` | int | `
9292
` | Exposed port of current service to users|
| `
name
` | str | `
""
` | Service name, can be used to generate HTTP request url |
| `
model
` | str | `
""
` | Path of paddle model directory to be served |
| `
mem_optim
` | - | - | En
able memory optimization |
| `
mem_optim
_off
` | - | - | Dis
able memory optimization |
| `
ir_optim
` | - | - | Enable analysis and optimization of calculation graph |
| `
use_mkl
` (Only for cpu version) | - | - | Run inference with MKL |
...
...
cmake/external/brpc.cmake
浏览文件 @
2f3f9bb6
...
...
@@ -40,8 +40,8 @@ ExternalProject_Add(
extern_brpc
${
EXTERNAL_PROJECT_LOG_ARGS
}
# TODO(gongwb): change to de newst repo when they changed.
GIT_REPOSITORY
"https://github.com/
gongweibao
/brpc"
GIT_TAG
"
e9b67ec1b7458f2af5fae76451afe1e27e01b4b4
"
GIT_REPOSITORY
"https://github.com/
wangjiawei04
/brpc"
GIT_TAG
"
6d79e0b17f25107c35b705ea58d888083f59ff47
"
PREFIX
${
BRPC_SOURCES_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
...
...
doc/FAQ.md
浏览文件 @
2f3f9bb6
...
...
@@ -13,6 +13,3 @@
client.set_rpc_timeout_ms(100000)
client.connect(["127.0.0.1:9393"])
```
-
Q: 执行GPU预测时出现显存不足的问题应该怎么办?
A: 请使用--thread 4参数限制server端的线程数为4,并使用--mem_optim参数开启显存优化选项。
python/paddle_serving_server/serve.py
浏览文件 @
2f3f9bb6
...
...
@@ -40,7 +40,7 @@ def parse_args(): # pylint: disable=doc-string-missing
parser
.
add_argument
(
"--device"
,
type
=
str
,
default
=
"cpu"
,
help
=
"Type of device"
)
parser
.
add_argument
(
"--mem_optim"
,
"--mem_optim
_off
"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Memory optimize"
)
...
...
@@ -68,7 +68,7 @@ def start_standard_model(): # pylint: disable=doc-string-missing
port
=
args
.
port
workdir
=
args
.
workdir
device
=
args
.
device
mem_optim
=
args
.
mem_optim
mem_optim
=
args
.
mem_optim
_off
is
False
ir_optim
=
args
.
ir_optim
max_body_size
=
args
.
max_body_size
use_mkl
=
args
.
use_mkl
...
...
python/paddle_serving_server/web_service.py
浏览文件 @
2f3f9bb6
...
...
@@ -41,6 +41,8 @@ class WebService(object):
server
=
Server
()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
16
)
server
.
set_memory_optimize
(
self
.
mem_optim
)
server
.
set_ir_optimize
(
self
.
ir_optim
)
server
.
load_model_config
(
self
.
model_config
)
server
.
prepare_server
(
workdir
=
self
.
workdir
,
port
=
self
.
port_list
[
0
],
device
=
self
.
device
)
...
...
@@ -55,12 +57,19 @@ class WebService(object):
else
:
return
False
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
device
=
"cpu"
):
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
device
=
"cpu"
,
mem_optim
=
True
,
ir_optim
=
False
):
self
.
workdir
=
workdir
self
.
port
=
port
self
.
device
=
device
default_port
=
12000
self
.
port_list
=
[]
self
.
mem_optim
=
mem_optim
self
.
ir_optim
=
ir_optim
for
i
in
range
(
1000
):
if
self
.
port_is_available
(
default_port
+
i
):
self
.
port_list
.
append
(
default_port
+
i
)
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
2f3f9bb6
...
...
@@ -41,7 +41,7 @@ from concurrent import futures
def
serve_args
():
parser
=
argparse
.
ArgumentParser
(
"serve"
)
parser
.
add_argument
(
"--thread"
,
type
=
int
,
default
=
4
,
help
=
"Concurrency of server"
)
"--thread"
,
type
=
int
,
default
=
2
,
help
=
"Concurrency of server"
)
parser
.
add_argument
(
"--model"
,
type
=
str
,
default
=
""
,
help
=
"Model for serving"
)
parser
.
add_argument
(
...
...
@@ -57,7 +57,7 @@ def serve_args():
parser
.
add_argument
(
"--name"
,
type
=
str
,
default
=
"None"
,
help
=
"Default service name"
)
parser
.
add_argument
(
"--mem_optim"
,
"--mem_optim
_off
"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Memory optimize"
)
...
...
@@ -187,7 +187,7 @@ class Server(object):
self
.
cube_config_fn
=
"cube.conf"
self
.
workdir
=
""
self
.
max_concurrency
=
0
self
.
num_threads
=
4
self
.
num_threads
=
2
self
.
port
=
8080
self
.
reload_interval_s
=
10
self
.
max_body_size
=
64
*
1024
*
1024
...
...
python/paddle_serving_server_gpu/serve.py
浏览文件 @
2f3f9bb6
...
...
@@ -34,7 +34,7 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss
port
=
args
.
port
+
index
thread_num
=
args
.
thread
model
=
args
.
model
mem_optim
=
args
.
mem_optim
mem_optim
=
args
.
mem_optim
_off
is
False
ir_optim
=
args
.
ir_optim
max_body_size
=
args
.
max_body_size
use_multilang
=
args
.
use_multilang
...
...
python/paddle_serving_server_gpu/web_service.py
浏览文件 @
2f3f9bb6
...
...
@@ -41,7 +41,9 @@ class WebService(object):
workdir
=
"conf"
,
port
=
9292
,
gpuid
=
0
,
thread_num
=
10
):
thread_num
=
2
,
mem_optim
=
True
,
ir_optim
=
False
):
device
=
"gpu"
if
gpuid
==
-
1
:
device
=
"cpu"
...
...
@@ -58,6 +60,8 @@ class WebService(object):
server
=
Server
()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
thread_num
)
server
.
set_mem_optim
(
mem_optim
)
server
.
set_ir_optim
(
ir_optim
)
server
.
load_model_config
(
self
.
model_config
)
if
gpuid
>=
0
:
...
...
@@ -77,7 +81,13 @@ class WebService(object):
else
:
return
False
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
device
=
"gpu"
,
gpuid
=
0
):
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
device
=
"gpu"
,
gpuid
=
0
,
mem_optim
=
True
,
ir_optim
=
False
):
self
.
workdir
=
workdir
self
.
port
=
port
self
.
device
=
device
...
...
@@ -94,7 +104,12 @@ class WebService(object):
# init cpu service
self
.
rpc_service_list
.
append
(
self
.
default_rpc_service
(
self
.
workdir
,
self
.
port_list
[
0
],
-
1
,
thread_num
=
10
))
self
.
workdir
,
self
.
port_list
[
0
],
-
1
,
thread_num
=
2
,
mem_optim
,
ir_optim
))
else
:
for
i
,
gpuid
in
enumerate
(
self
.
gpus
):
self
.
rpc_service_list
.
append
(
...
...
@@ -102,7 +117,9 @@ class WebService(object):
"{}_{}"
.
format
(
self
.
workdir
,
i
),
self
.
port_list
[
i
],
gpuid
,
thread_num
=
10
))
thread_num
=
2
,
mem_optim
,
ir_optim
))
def
_launch_web_service
(
self
):
gpu_num
=
len
(
self
.
gpus
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录