Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
04a41adf
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看板
提交
04a41adf
编写于
7月 06, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine cube demo
上级
eaa5ed4d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
13 deletion
+31
-13
python/examples/criteo_ctr_with_cube/test_server.py
python/examples/criteo_ctr_with_cube/test_server.py
+5
-1
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+13
-3
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+13
-3
tools/serving_build.sh
tools/serving_build.sh
+0
-6
未找到文件。
python/examples/criteo_ctr_with_cube/test_server.py
浏览文件 @
04a41adf
...
...
@@ -33,5 +33,9 @@ server = Server()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
4
)
server
.
load_model_config
(
sys
.
argv
[
1
])
server
.
prepare_server
(
workdir
=
"work_dir1"
,
port
=
9292
,
device
=
"cpu"
)
server
.
prepare_server
(
workdir
=
"work_dir1"
,
port
=
9292
,
device
=
"cpu"
,
cube_conf
=
"./cube/conf/cube.conf"
)
server
.
run_server
()
python/paddle_serving_server/__init__.py
浏览文件 @
04a41adf
...
...
@@ -25,6 +25,7 @@ from contextlib import closing
import
collections
import
fcntl
import
shutil
import
numpy
as
np
import
grpc
from
.proto
import
multi_lang_general_model_service_pb2
...
...
@@ -230,7 +231,7 @@ class Server(object):
infer_service
.
workflows
.
extend
([
"workflow1"
])
self
.
infer_service_conf
.
services
.
extend
([
infer_service
])
def
_prepare_resource
(
self
,
workdir
):
def
_prepare_resource
(
self
,
workdir
,
cube_conf
):
self
.
workdir
=
workdir
if
self
.
resource_conf
==
None
:
with
open
(
"{}/{}"
.
format
(
workdir
,
self
.
general_model_config_fn
),
...
...
@@ -242,6 +243,11 @@ class Server(object):
if
"dist_kv"
in
node
.
name
:
self
.
resource_conf
.
cube_config_path
=
workdir
self
.
resource_conf
.
cube_config_file
=
self
.
cube_config_fn
if
cube_conf
==
None
:
raise
ValueError
(
"Please set the path of cube.conf while use dist_kv op."
)
shutil
.
copy
(
cube_conf
,
workdir
)
if
"quant"
in
node
.
name
:
self
.
resource_conf
.
cube_quant_bits
=
8
self
.
resource_conf
.
model_toolkit_path
=
workdir
...
...
@@ -366,7 +372,11 @@ class Server(object):
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
def
prepare_server
(
self
,
workdir
=
None
,
port
=
9292
,
device
=
"cpu"
):
def
prepare_server
(
self
,
workdir
=
None
,
port
=
9292
,
device
=
"cpu"
,
cube_conf
=
None
):
if
workdir
==
None
:
workdir
=
"./tmp"
os
.
system
(
"mkdir {}"
.
format
(
workdir
))
...
...
@@ -377,7 +387,7 @@ class Server(object):
if
not
self
.
port_is_available
(
port
):
raise
SystemExit
(
"Port {} is already used"
.
format
(
port
))
self
.
set_port
(
port
)
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_resource
(
workdir
,
cube_conf
)
self
.
_prepare_engine
(
self
.
model_config_paths
,
device
)
self
.
_prepare_infer_service
(
port
)
self
.
workdir
=
workdir
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
04a41adf
...
...
@@ -26,7 +26,7 @@ from contextlib import closing
import
argparse
import
collections
import
fcntl
import
shutil
import
numpy
as
np
import
grpc
from
.proto
import
multi_lang_general_model_service_pb2
...
...
@@ -285,7 +285,7 @@ class Server(object):
infer_service
.
workflows
.
extend
([
"workflow1"
])
self
.
infer_service_conf
.
services
.
extend
([
infer_service
])
def
_prepare_resource
(
self
,
workdir
):
def
_prepare_resource
(
self
,
workdir
,
cube_conf
):
self
.
workdir
=
workdir
if
self
.
resource_conf
==
None
:
with
open
(
"{}/{}"
.
format
(
workdir
,
self
.
general_model_config_fn
),
...
...
@@ -297,6 +297,11 @@ class Server(object):
if
"dist_kv"
in
node
.
name
:
self
.
resource_conf
.
cube_config_path
=
workdir
self
.
resource_conf
.
cube_config_file
=
self
.
cube_config_fn
if
cube_conf
==
None
:
raise
ValueError
(
"Please set the path of cube.conf while use dist_kv op."
)
shutil
.
copy
(
cube_conf
,
workdir
)
self
.
resource_conf
.
model_toolkit_path
=
workdir
self
.
resource_conf
.
model_toolkit_file
=
self
.
model_toolkit_fn
self
.
resource_conf
.
general_model_path
=
workdir
...
...
@@ -406,7 +411,11 @@ class Server(object):
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
def
prepare_server
(
self
,
workdir
=
None
,
port
=
9292
,
device
=
"cpu"
):
def
prepare_server
(
self
,
workdir
=
None
,
port
=
9292
,
device
=
"cpu"
,
cube_conf
=
None
):
if
workdir
==
None
:
workdir
=
"./tmp"
os
.
system
(
"mkdir {}"
.
format
(
workdir
))
...
...
@@ -419,6 +428,7 @@ class Server(object):
self
.
set_port
(
port
)
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_resource
(
workdir
,
cube_conf
)
self
.
_prepare_engine
(
self
.
model_config_paths
,
device
)
self
.
_prepare_infer_service
(
port
)
self
.
workdir
=
workdir
...
...
tools/serving_build.sh
浏览文件 @
04a41adf
...
...
@@ -229,10 +229,7 @@ function python_run_criteo_ctr_with_cube() {
check_cmd
"mv models/data ./cube/"
check_cmd
"mv models/ut_data ./"
cp
../../../build-server-
$TYPE
/output/bin/cube
*
./cube/
mkdir
-p
$PYTHONROOT
/lib/python2.7/site-packages/paddle_serving_server/serving-cpu-avx-openblas-0.1.3/
yes
|
cp
../../../build-server-
$TYPE
/output/demo/serving/bin/serving
$PYTHONROOT
/lib/python2.7/site-packages/paddle_serving_server/serving-cpu-avx-openblas-0.1.3/
sh cube_prepare.sh &
check_cmd
"mkdir work_dir1 && cp cube/conf/cube.conf ./work_dir1/"
python test_server.py ctr_serving_model_kv &
sleep
5
check_cmd
"python test_client.py ctr_client_conf/serving_client_conf.prototxt ./ut_data >score"
...
...
@@ -257,10 +254,7 @@ function python_run_criteo_ctr_with_cube() {
check_cmd
"mv models/data ./cube/"
check_cmd
"mv models/ut_data ./"
cp
../../../build-server-
$TYPE
/output/bin/cube
*
./cube/
mkdir
-p
$PYTHONROOT
/lib/python2.7/site-packages/paddle_serving_server_gpu/serving-gpu-0.1.3/
yes
|
cp
../../../build-server-
$TYPE
/output/demo/serving/bin/serving
$PYTHONROOT
/lib/python2.7/site-packages/paddle_serving_server_gpu/serving-gpu-0.1.3/
sh cube_prepare.sh &
check_cmd
"mkdir work_dir1 && cp cube/conf/cube.conf ./work_dir1/"
python test_server_gpu.py ctr_serving_model_kv &
sleep
5
# for warm up
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录