Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
bfb4c711
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看板
提交
bfb4c711
编写于
5月 30, 2020
作者:
B
barriery
提交者:
GitHub
5月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into fix-issue-618
上级
1e6dda10
6f1ebe7a
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
227 addition
and
13 deletion
+227
-13
README.md
README.md
+3
-0
README_CN.md
README_CN.md
+3
-0
python/examples/bert/bert_web_service.py
python/examples/bert/bert_web_service.py
+4
-1
python/examples/deeplabv3/README.md
python/examples/deeplabv3/README.md
+22
-0
python/examples/deeplabv3/README_CN.md
python/examples/deeplabv3/README_CN.md
+21
-0
python/examples/deeplabv3/deeplabv3_client.py
python/examples/deeplabv3/deeplabv3_client.py
+1
-1
python/examples/faster_rcnn_model/README.md
python/examples/faster_rcnn_model/README.md
+2
-2
python/examples/faster_rcnn_model/README_CN.md
python/examples/faster_rcnn_model/README_CN.md
+1
-1
python/examples/imagenet/README_CN.md
python/examples/imagenet/README_CN.md
+2
-2
python/examples/mobilenet/README.md
python/examples/mobilenet/README.md
+22
-0
python/examples/mobilenet/README_CN.md
python/examples/mobilenet/README_CN.md
+22
-0
python/examples/resnet_v2_50/README.md
python/examples/resnet_v2_50/README.md
+22
-0
python/examples/resnet_v2_50/README_CN.md
python/examples/resnet_v2_50/README_CN.md
+22
-0
python/examples/unet_for_image_seg/README.md
python/examples/unet_for_image_seg/README.md
+22
-0
python/examples/unet_for_image_seg/README_CN.md
python/examples/unet_for_image_seg/README_CN.md
+22
-0
python/paddle_serving_app/README.md
python/paddle_serving_app/README.md
+1
-1
python/paddle_serving_app/README_CN.md
python/paddle_serving_app/README_CN.md
+1
-1
python/paddle_serving_app/reader/image_reader.py
python/paddle_serving_app/reader/image_reader.py
+4
-1
python/paddle_serving_client/__init__.py
python/paddle_serving_client/__init__.py
+15
-3
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+7
-0
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+8
-0
未找到文件。
README.md
浏览文件 @
bfb4c711
(
[
简体中文
](
./README_CN.md
)
|English)
<p
align=
"center"
>
<br>
<img
src=
'doc/serving_logo.png'
width =
"600"
height =
"130"
>
<br>
<p>
<p
align=
"center"
>
<br>
<a
href=
"https://travis-ci.com/PaddlePaddle/Serving"
>
...
...
README_CN.md
浏览文件 @
bfb4c711
(简体中文|
[
English
](
./README.md
)
)
<p
align=
"center"
>
<br>
<img
src=
'https://paddle-serving.bj.bcebos.com/imdb-demo%2FLogoMakr-3Bd2NM-300dpi.png'
width =
"600"
height =
"130"
>
<br>
<p>
<p
align=
"center"
>
<br>
<a
href=
"https://travis-ci.com/PaddlePaddle/Serving"
>
...
...
python/examples/bert/bert_web_service.py
浏览文件 @
bfb4c711
...
...
@@ -21,7 +21,10 @@ import os
class
BertService
(
WebService
):
def
load
(
self
):
self
.
reader
=
ChineseBertReader
(
vocab_file
=
"vocab.txt"
,
max_seq_len
=
128
)
self
.
reader
=
ChineseBertReader
({
"vocab_file"
:
"vocab.txt"
,
"max_seq_len"
:
128
})
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
feed_res
=
[
...
...
python/examples/deeplabv3/README.md
0 → 100644
浏览文件 @
bfb4c711
# Image Segmentation
## Get Model
```
python -m paddle_serving_app.package --get_model deeplabv3
tar -xzvf deeplabv3.tar.gz
```
## RPC Service
### Start Service
```
python -m paddle_serving_server_gpu.serve --model deeplabv3_server --gpu_ids 0 --port 9494
```
### Client Prediction
```
python deeplabv3_client.py
```
python/examples/deeplabv3/README_CN.md
0 → 100644
浏览文件 @
bfb4c711
# 图像分割
## 获取模型
```
python -m paddle_serving_app.package --get_model deeplabv3
tar -xzvf deeplabv3.tar.gz
```
## RPC 服务
### 启动服务端
```
python -m paddle_serving_server_gpu.serve --model deeplabv3_server --gpu_ids 0 --port 9494
```
### 客户端预测
```
python deeplabv3_client.py
python/examples/deeplabv3/deeplabv3_client.py
浏览文件 @
bfb4c711
...
...
@@ -18,7 +18,7 @@ import sys
import
cv2
client
=
Client
()
client
.
load_client_config
(
"
seg
_client/serving_client_conf.prototxt"
)
client
.
load_client_config
(
"
deeplabv3
_client/serving_client_conf.prototxt"
)
client
.
connect
([
"127.0.0.1:9494"
])
preprocess
=
Sequential
(
...
...
python/examples/faster_rcnn_model/README.md
浏览文件 @
bfb4c711
...
...
@@ -12,8 +12,8 @@ If you want to have more detection models, please refer to [Paddle Detection Mod
### Start the service
```
tar xf faster_rcnn_model.tar.gz
mv faster_rcnn_model/pddet
*
.
GLOG_v=2 python -m paddle_serving_server_gpu.serve --model pddet_serving_model --port 9494 --gpu_id 0
mv faster_rcnn_model/pddet
*
.
GLOG_v=2 python -m paddle_serving_server_gpu.serve --model pddet_serving_model --port 9494 --gpu_id
s
0
```
### Perform prediction
...
...
python/examples/faster_rcnn_model/README_CN.md
浏览文件 @
bfb4c711
...
...
@@ -13,7 +13,7 @@ wget https://paddle-serving.bj.bcebos.com/pddet_demo/infer_cfg.yml
```
tar xf faster_rcnn_model.tar.gz
mv faster_rcnn_model/pddet* ./
GLOG_v=2 python -m paddle_serving_server_gpu.serve --model pddet_serving_model --port 9494 --gpu_id 0
GLOG_v=2 python -m paddle_serving_server_gpu.serve --model pddet_serving_model --port 9494 --gpu_id
s
0
```
### 执行预测
...
...
python/examples/imagenet/README_CN.md
浏览文件 @
bfb4c711
...
...
@@ -19,10 +19,10 @@ pip install paddle_serving_app
启动server端
```
python
image_classification
_service.py ResNet50_vd_model cpu 9696 #cpu预测服务
python
resnet50_web
_service.py ResNet50_vd_model cpu 9696 #cpu预测服务
```
```
python
image_classification
_service.py ResNet50_vd_model gpu 9696 #gpu预测服务
python
resnet50_web
_service.py ResNet50_vd_model gpu 9696 #gpu预测服务
```
...
...
python/examples/mobilenet/README.md
0 → 100644
浏览文件 @
bfb4c711
# Image Classification
## Get Model
```
python -m paddle_serving_app.package --get_model mobilenet_v2_imagenet
tar -xzvf mobilenet_v2_imagenet.tar.gz
```
## RPC Service
### Start Service
```
python -m paddle_serving_server_gpu.serve --model mobilenet_v2_imagenet_model --gpu_ids 0 --port 9393
```
### Client Prediction
```
python mobilenet_tutorial.py
```
python/examples/mobilenet/README_CN.md
0 → 100644
浏览文件 @
bfb4c711
# 图像分类
## 获取模型
```
python -m paddle_serving_app.package --get_model mobilenet_v2_imagenet
tar -xzvf mobilenet_v2_imagenet.tar.gz
```
## RPC 服务
### 启动服务端
```
python -m paddle_serving_server_gpu.serve --model mobilenet_v2_imagenet_model --gpu_ids 0 --port 9393
```
### 客户端预测
```
python mobilenet_tutorial.py
```
python/examples/resnet_v2_50/README.md
0 → 100644
浏览文件 @
bfb4c711
# Image Classification
## Get Model
```
python -m paddle_serving_app.package --get_model resnet_v2_50_imagenet
tar -xzvf resnet_v2_50_imagenet.tar.gz
```
## RPC Service
### Start Service
```
python -m paddle_serving_server_gpu.serve --model resnet_v2_50_imagenet_model --gpu_ids 0 --port 9393
```
### Client Prediction
```
python resnet50_v2_tutorial.py
```
python/examples/resnet_v2_50/README_CN.md
0 → 100644
浏览文件 @
bfb4c711
# 图像分类
## 获取模型
```
python -m paddle_serving_app.package --get_model resnet_v2_50_imagenet
tar -xzvf resnet_v2_50_imagenet.tar.gz
```
## RPC 服务
### 启动服务端
```
python -m paddle_serving_server_gpu.serve --model resnet_v2_50_imagenet_model --gpu_ids 0 --port 9393
```
### 客户端预测
```
python resnet50_v2_tutorial.py
```
python/examples/unet_for_image_seg/README.md
0 → 100644
浏览文件 @
bfb4c711
# Image Segmentation
## Get Model
```
python -m paddle_serving_app.package --get_model unet
tar -xzvf unet.tar.gz
```
## RPC Service
### Start Service
```
python -m paddle_serving_server_gpu.serve --model unet_model --gpu_ids 0 --port 9494
```
### Client Prediction
```
python seg_client.py
```
python/examples/unet_for_image_seg/README_CN.md
0 → 100644
浏览文件 @
bfb4c711
# 图像分割
## 获取模型
```
python -m paddle_serving_app.package --get_model unet
tar -xzvf unet.tar.gz
```
## RPC 服务
### 启动服务端
```
python -m paddle_serving_server_gpu.serve --model unet_model --gpu_ids 0 --port 9494
```
### 客户端预测
```
python seg_client.py
```
python/paddle_serving_app/README.md
浏览文件 @
bfb4c711
...
...
@@ -12,7 +12,7 @@ pip install paddle_serving_app
## Get model list
```
shell
python
-m
paddle_serving_app.package
--
model_list
python
-m
paddle_serving_app.package
--
list_model
```
## Download pre-training model
...
...
python/paddle_serving_app/README_CN.md
浏览文件 @
bfb4c711
...
...
@@ -11,7 +11,7 @@ pip install paddle_serving_app
## 获取模型列表
```
shell
python
-m
paddle_serving_app.package
--
model_list
python
-m
paddle_serving_app.package
--
list_model
```
## 下载预训练模型
...
...
python/paddle_serving_app/reader/image_reader.py
浏览文件 @
bfb4c711
...
...
@@ -296,7 +296,10 @@ class File2Image(object):
pass
def
__call__
(
self
,
img_path
):
fin
=
open
(
img_path
)
if
py_version
==
2
:
fin
=
open
(
img_path
)
else
:
fin
=
open
(
img_path
,
"rb"
)
sample
=
fin
.
read
()
data
=
np
.
fromstring
(
sample
,
np
.
uint8
)
img
=
cv2
.
imdecode
(
data
,
cv2
.
IMREAD_COLOR
)
...
...
python/paddle_serving_client/__init__.py
浏览文件 @
bfb4c711
...
...
@@ -61,13 +61,18 @@ class SDKConfig(object):
self
.
tag_list
=
[]
self
.
cluster_list
=
[]
self
.
variant_weight_list
=
[]
self
.
rpc_timeout_ms
=
20000
self
.
load_balance_strategy
=
"la"
def
add_server_variant
(
self
,
tag
,
cluster
,
variant_weight
):
self
.
tag_list
.
append
(
tag
)
self
.
cluster_list
.
append
(
cluster
)
self
.
variant_weight_list
.
append
(
variant_weight
)
def
gen_desc
(
self
):
def
set_load_banlance_strategy
(
self
,
strategy
):
self
.
load_balance_strategy
=
strategy
def
gen_desc
(
self
,
rpc_timeout_ms
):
predictor_desc
=
sdk
.
Predictor
()
predictor_desc
.
name
=
"general_model"
predictor_desc
.
service_name
=
\
...
...
@@ -86,7 +91,7 @@ class SDKConfig(object):
self
.
sdk_desc
.
predictors
.
extend
([
predictor_desc
])
self
.
sdk_desc
.
default_variant_conf
.
tag
=
"default"
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
connect_timeout_ms
=
2000
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
rpc_timeout_ms
=
20000
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
rpc_timeout_ms
=
rpc_timeout_ms
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
connect_retry_count
=
2
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
max_connection_per_host
=
100
self
.
sdk_desc
.
default_variant_conf
.
connection_conf
.
hedge_request_timeout_ms
=
-
1
...
...
@@ -119,6 +124,7 @@ class Client(object):
self
.
profile_
=
_Profiler
()
self
.
all_numpy_input
=
True
self
.
has_numpy_input
=
False
self
.
rpc_timeout_ms
=
20000
def
load_client_config
(
self
,
path
):
from
.serving_client
import
PredictorClient
...
...
@@ -171,6 +177,12 @@ class Client(object):
self
.
predictor_sdk_
.
add_server_variant
(
tag
,
cluster
,
str
(
variant_weight
))
def
set_rpc_timeout_ms
(
self
,
rpc_timeout
):
if
not
isinstance
(
rpc_timeout
,
int
):
raise
ValueError
(
"rpc_timeout must be int type."
)
else
:
self
.
rpc_timeout_ms
=
rpc_timeout
def
connect
(
self
,
endpoints
=
None
):
# check whether current endpoint is available
# init from client config
...
...
@@ -188,7 +200,7 @@ class Client(object):
print
(
"parameter endpoints({}) will not take effect, because you use the add_variant function."
.
format
(
endpoints
))
sdk_desc
=
self
.
predictor_sdk_
.
gen_desc
()
sdk_desc
=
self
.
predictor_sdk_
.
gen_desc
(
self
.
rpc_timeout_ms
)
self
.
client_handle_
.
create_predictor_by_desc
(
sdk_desc
.
SerializeToString
(
))
...
...
python/paddle_serving_server/__init__.py
浏览文件 @
bfb4c711
...
...
@@ -23,6 +23,7 @@ import paddle_serving_server as paddle_serving_server
from
.version
import
serving_server_version
from
contextlib
import
closing
import
collections
import
fcntl
class
OpMaker
(
object
):
...
...
@@ -322,6 +323,10 @@ class Server(object):
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
floder_name
)
#acquire lock
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
fcntl
.
flock
(
version_file
,
fcntl
.
LOCK_EX
)
if
not
os
.
path
.
exists
(
self
.
server_path
):
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
...
...
@@ -345,6 +350,8 @@ class Server(object):
foemat
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
#release lock
version_file
.
close
()
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
bfb4c711
...
...
@@ -25,6 +25,7 @@ from .version import serving_server_version
from
contextlib
import
closing
import
argparse
import
collections
import
fcntl
def
serve_args
():
...
...
@@ -347,6 +348,11 @@ class Server(object):
download_flag
=
"{}/{}.is_download"
.
format
(
self
.
module_path
,
folder_name
)
#acquire lock
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
fcntl
.
flock
(
version_file
,
fcntl
.
LOCK_EX
)
if
os
.
path
.
exists
(
download_flag
):
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
...
...
@@ -377,6 +383,8 @@ class Server(object):
format
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
#release lock
version_file
.
cloes
()
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录