Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
daa2290d
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看板
未验证
提交
daa2290d
编写于
6月 26, 2020
作者:
D
Dong Daxiang
提交者:
GitHub
6月 26, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #679 from gongweibao/fixtypo
Fix some typos and prepare to merge the duplicate codes.
上级
e90415bc
8251d1cf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
55 addition
and
41 deletion
+55
-41
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+7
-6
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+2
-2
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+1
-1
python/paddle_serving_server_gpu/web_service.py
python/paddle_serving_server_gpu/web_service.py
+3
-3
tools/Dockerfile
tools/Dockerfile
+3
-2
tools/Dockerfile.devel
tools/Dockerfile.devel
+17
-12
tools/Dockerfile.gpu
tools/Dockerfile.gpu
+6
-4
tools/Dockerfile.gpu.devel
tools/Dockerfile.gpu.devel
+16
-11
未找到文件。
python/paddle_serving_server/__init__.py
浏览文件 @
daa2290d
...
@@ -231,6 +231,7 @@ class Server(object):
...
@@ -231,6 +231,7 @@ class Server(object):
self
.
infer_service_conf
.
services
.
extend
([
infer_service
])
self
.
infer_service_conf
.
services
.
extend
([
infer_service
])
def
_prepare_resource
(
self
,
workdir
):
def
_prepare_resource
(
self
,
workdir
):
self
.
workdir
=
workdir
if
self
.
resource_conf
==
None
:
if
self
.
resource_conf
==
None
:
with
open
(
"{}/{}"
.
format
(
workdir
,
self
.
general_model_config_fn
),
with
open
(
"{}/{}"
.
format
(
workdir
,
self
.
general_model_config_fn
),
"w"
)
as
fout
:
"w"
)
as
fout
:
...
@@ -328,10 +329,10 @@ class Server(object):
...
@@ -328,10 +329,10 @@ class Server(object):
os
.
chdir
(
self
.
module_path
)
os
.
chdir
(
self
.
module_path
)
need_download
=
False
need_download
=
False
device_version
=
self
.
get_device_version
()
device_version
=
self
.
get_device_version
()
f
lo
der_name
=
device_version
+
serving_server_version
f
ol
der_name
=
device_version
+
serving_server_version
tar_name
=
f
lo
der_name
+
".tar.gz"
tar_name
=
f
ol
der_name
+
".tar.gz"
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
f
lo
der_name
)
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
f
ol
der_name
)
#acquire lock
#acquire lock
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
...
@@ -357,7 +358,7 @@ class Server(object):
...
@@ -357,7 +358,7 @@ class Server(object):
os
.
remove
(
exe_path
)
os
.
remove
(
exe_path
)
raise
SystemExit
(
raise
SystemExit
(
'Decompressing failed, please check your permission of {} or disk space left.'
.
'Decompressing failed, please check your permission of {} or disk space left.'
.
fo
e
mat
(
self
.
module_path
))
fo
r
mat
(
self
.
module_path
))
finally
:
finally
:
os
.
remove
(
tar_name
)
os
.
remove
(
tar_name
)
#release lock
#release lock
...
@@ -374,11 +375,11 @@ class Server(object):
...
@@ -374,11 +375,11 @@ class Server(object):
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
if
not
self
.
port_is_available
(
port
):
if
not
self
.
port_is_available
(
port
):
raise
SystemExit
(
"Prot {} is already used"
.
format
(
port
))
raise
SystemExit
(
"Port {} is already used"
.
format
(
port
))
self
.
set_port
(
port
)
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_engine
(
self
.
model_config_paths
,
device
)
self
.
_prepare_engine
(
self
.
model_config_paths
,
device
)
self
.
_prepare_infer_service
(
port
)
self
.
_prepare_infer_service
(
port
)
self
.
port
=
port
self
.
workdir
=
workdir
self
.
workdir
=
workdir
infer_service_fn
=
"{}/{}"
.
format
(
workdir
,
self
.
infer_service_fn
)
infer_service_fn
=
"{}/{}"
.
format
(
workdir
,
self
.
infer_service_fn
)
...
...
python/paddle_serving_server/web_service.py
浏览文件 @
daa2290d
...
@@ -85,9 +85,9 @@ class WebService(object):
...
@@ -85,9 +85,9 @@ class WebService(object):
fetch_map
=
self
.
client
.
predict
(
feed
=
feed
,
fetch
=
fetch
)
fetch_map
=
self
.
client
.
predict
(
feed
=
feed
,
fetch
=
fetch
)
for
key
in
fetch_map
:
for
key
in
fetch_map
:
fetch_map
[
key
]
=
fetch_map
[
key
].
tolist
()
fetch_map
[
key
]
=
fetch_map
[
key
].
tolist
()
fetch_map
=
self
.
postprocess
(
result
=
self
.
postprocess
(
feed
=
request
.
json
[
"feed"
],
fetch
=
fetch
,
fetch_map
=
fetch_map
)
feed
=
request
.
json
[
"feed"
],
fetch
=
fetch
,
fetch_map
=
fetch_map
)
result
=
{
"result"
:
fetch_map
}
result
=
{
"result"
:
result
}
except
ValueError
:
except
ValueError
:
result
=
{
"result"
:
"Request Value Error"
}
result
=
{
"result"
:
"Request Value Error"
}
return
result
return
result
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
daa2290d
...
@@ -415,7 +415,7 @@ class Server(object):
...
@@ -415,7 +415,7 @@ class Server(object):
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
if
not
self
.
port_is_available
(
port
):
if
not
self
.
port_is_available
(
port
):
raise
SystemExit
(
"P
ro
t {} is already used"
.
format
(
port
))
raise
SystemExit
(
"P
or
t {} is already used"
.
format
(
port
))
self
.
set_port
(
port
)
self
.
set_port
(
port
)
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_resource
(
workdir
)
...
...
python/paddle_serving_server_gpu/web_service.py
浏览文件 @
daa2290d
...
@@ -50,12 +50,12 @@ class WebService(object):
...
@@ -50,12 +50,12 @@ class WebService(object):
general_infer_op
=
op_maker
.
create
(
'general_infer'
)
general_infer_op
=
op_maker
.
create
(
'general_infer'
)
general_response_op
=
op_maker
.
create
(
'general_response'
)
general_response_op
=
op_maker
.
create
(
'general_response'
)
op_seq_maker
=
serving
.
OpSeqMaker
()
op_seq_maker
=
OpSeqMaker
()
op_seq_maker
.
add_op
(
read_op
)
op_seq_maker
.
add_op
(
read_op
)
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
=
serving
.
Server
()
server
=
Server
()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
thread_num
)
server
.
set_num_threads
(
thread_num
)
...
@@ -171,7 +171,7 @@ class WebService(object):
...
@@ -171,7 +171,7 @@ class WebService(object):
processes
=
1
)
processes
=
1
)
def
get_app_instance
(
self
):
def
get_app_instance
(
self
):
return
app_instance
return
self
.
app_instance
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
return
feed
,
fetch
return
feed
,
fetch
...
...
tools/Dockerfile
浏览文件 @
daa2290d
...
@@ -7,8 +7,9 @@ RUN yum -y install wget && \
...
@@ -7,8 +7,9 @@ RUN yum -y install wget && \
yum
-y
install
libXrender-0.9.10-1.el7.x86_64
--setopt
=
protected_multilib
=
false
&&
\
yum
-y
install
libXrender-0.9.10-1.el7.x86_64
--setopt
=
protected_multilib
=
false
&&
\
yum
-y
install
libXext-1.3.3-3.el7.x86_64
--setopt
=
protected_multilib
=
false
&&
\
yum
-y
install
libXext-1.3.3-3.el7.x86_64
--setopt
=
protected_multilib
=
false
&&
\
yum
-y
install
python3 python3-devel
&&
\
yum
-y
install
python3 python3-devel
&&
\
yum clean all
&&
\
yum clean all
curl https://bootstrap.pypa.io/get-pip.py
-o
get-pip.py
&&
\
RUN
curl https://bootstrap.pypa.io/get-pip.py
-o
get-pip.py
&&
\
python get-pip.py
&&
rm
get-pip.py
&&
\
python get-pip.py
&&
rm
get-pip.py
&&
\
localedef
-c
-i
en_US
-f
UTF-8 en_US.UTF-8
&&
\
localedef
-c
-i
en_US
-f
UTF-8 en_US.UTF-8
&&
\
echo
"export LANG=en_US.utf8"
>>
/root/.bashrc
echo
"export LANG=en_US.utf8"
>>
/root/.bashrc
tools/Dockerfile.devel
浏览文件 @
daa2290d
FROM centos:7.3.1611
FROM centos:7.3.1611
RUN yum -y install wget >/dev/null \
RUN yum -y install wget \
&& yum -y install gcc gcc-c++ make glibc-static which >/dev/null \
&& yum -y install gcc gcc-c++ make glibc-static which \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel >/dev/null \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel
&& wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
RUN wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
&& tar xzf cmake-3.2.0-Linux-x86_64.tar.gz \
&& tar xzf cmake-3.2.0-Linux-x86_64.tar.gz \
&& mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 \
&& mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 \
&& echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz
&& wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
RUN wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
&& tar xzf go1.14.linux-amd64.tar.gz \
&& tar xzf go1.14.linux-amd64.tar.gz \
&& mv go /usr/local/go \
&& mv go /usr/local/go \
&& echo 'export GOROOT=/usr/local/go' >> /root/.bashrc \
&& echo 'export GOROOT=/usr/local/go' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc \
&& rm go1.14.linux-amd64.tar.gz \
&& rm go1.14.linux-amd64.tar.gz
&& yum -y install python-devel sqlite-devel >/dev/null \
RUN yum -y install python-devel sqlite-devel \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >/dev/null \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >/dev/null \
&& python get-pip.py >/dev/null \
&& python get-pip.py >/dev/null \
&& pip install google protobuf setuptools wheel flask >/dev/null \
&& pip install google protobuf setuptools wheel flask >/dev/null \
&& rm get-pip.py \
&& rm get-pip.py
&& yum install -y python3 python3-devel \
RUN yum install -y python3 python3-devel \
&& pip3 install google protobuf setuptools wheel flask \
&& pip3 install google protobuf setuptools wheel flask \
&& yum -y install epel-release && yum -y install patchelf libXext libSM libXrender\
&& yum -y install epel-release && yum -y install patchelf libXext libSM libXrender\
&& yum clean all \
&& yum clean all
&& localedef -c -i en_US -f UTF-8 en_US.UTF-8 \
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8 \
&& echo "export LANG=en_US.utf8" >> /root/.bashrc
&& echo "export LANG=en_US.utf8" >> /root/.bashrc
tools/Dockerfile.gpu
浏览文件 @
daa2290d
...
@@ -8,10 +8,12 @@ RUN yum -y install wget && \
...
@@ -8,10 +8,12 @@ RUN yum -y install wget && \
yum -y install libXrender-0.9.10-1.el7.x86_64 --setopt=protected_multilib=false && \
yum -y install libXrender-0.9.10-1.el7.x86_64 --setopt=protected_multilib=false && \
yum -y install libXext-1.3.3-3.el7.x86_64 --setopt=protected_multilib=false && \
yum -y install libXext-1.3.3-3.el7.x86_64 --setopt=protected_multilib=false && \
yum -y install python3 python3-devel && \
yum -y install python3 python3-devel && \
yum clean all && \
yum clean all
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && rm get-pip.py && \
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
ln -s /usr/local/cuda-9.0/lib64/libcublas.so.9.0 /usr/local/cuda-9.0/lib64/libcublas.so && \
python get-pip.py && rm get-pip.py
RUN ln -s /usr/local/cuda-9.0/lib64/libcublas.so.9.0 /usr/local/cuda-9.0/lib64/libcublas.so && \
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> /root/.bashrc && \
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> /root/.bashrc && \
ln -s /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so && \
ln -s /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so && \
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/targets/x86_64-linux/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/targets/x86_64-linux/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \
...
...
tools/Dockerfile.gpu.devel
浏览文件 @
daa2290d
FROM nvidia/cuda:9.0-cudnn7-devel-centos7
FROM nvidia/cuda:9.0-cudnn7-devel-centos7
RUN yum -y install wget >/dev/null \
RUN yum -y install wget >/dev/null \
&& yum -y install gcc gcc-c++ make glibc-static which >/dev/null \
&& yum -y install gcc gcc-c++ make glibc-static which \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel >/dev/null \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel
&& wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
RUN wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
&& tar xzf cmake-3.2.0-Linux-x86_64.tar.gz \
&& tar xzf cmake-3.2.0-Linux-x86_64.tar.gz \
&& mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 \
&& mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 \
&& echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz
&& wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
RUN wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
&& tar xzf go1.14.linux-amd64.tar.gz \
&& tar xzf go1.14.linux-amd64.tar.gz \
&& mv go /usr/local/go \
&& mv go /usr/local/go \
&& echo 'export GOROOT=/usr/local/go' >> /root/.bashrc \
&& echo 'export GOROOT=/usr/local/go' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc \
&& rm go1.14.linux-amd64.tar.gz \
&& rm go1.14.linux-amd64.tar.gz
&& yum -y install python-devel sqlite-devel >/dev/null \
RUN yum -y install python-devel sqlite-devel \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >/dev/null \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >/dev/null \
&& python get-pip.py >/dev/null \
&& python get-pip.py >/dev/null \
&& pip install google protobuf setuptools wheel flask >/dev/null \
&& pip install google protobuf setuptools wheel flask >/dev/null \
&& rm get-pip.py \
&& rm get-pip.py
&& yum install -y python3 python3-devel \
RUN yum install -y python3 python3-devel \
&& pip3 install google protobuf setuptools wheel flask \
&& pip3 install google protobuf setuptools wheel flask \
&& yum -y install epel-release && yum -y install patchelf libXext libSM libXrender\
&& yum -y install epel-release && yum -y install patchelf libXext libSM libXrender\
&& yum clean all \
&& yum clean all
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8 \
&& echo "export LANG=en_US.utf8" >> /root/.bashrc
&& echo "export LANG=en_US.utf8" >> /root/.bashrc
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录