Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
c500fcb3
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看板
提交
c500fcb3
编写于
5月 25, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix demo
上级
588d72ae
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
14 addition
and
14 deletion
+14
-14
python/examples/bert/benchmark.py
python/examples/bert/benchmark.py
+2
-2
python/examples/bert/bert_web_service.py
python/examples/bert/bert_web_service.py
+4
-4
python/examples/imagenet/resnet50_web_service.py
python/examples/imagenet/resnet50_web_service.py
+2
-2
python/examples/imdb/text_classify_service.py
python/examples/imdb/text_classify_service.py
+2
-2
python/examples/lac/benchmark.py
python/examples/lac/benchmark.py
+1
-1
python/examples/lac/lac_client.py
python/examples/lac/lac_client.py
+1
-1
python/examples/lac/lac_web_service.py
python/examples/lac/lac_web_service.py
+2
-2
未找到文件。
python/examples/bert/benchmark.py
浏览文件 @
c500fcb3
...
@@ -26,7 +26,7 @@ from batching import pad_batch_data
...
@@ -26,7 +26,7 @@ from batching import pad_batch_data
import
tokenization
import
tokenization
import
requests
import
requests
import
json
import
json
from
bert_reader
import
BertReader
from
paddle_serving_app.reader
import
Chinese
BertReader
args
=
benchmark_args
()
args
=
benchmark_args
()
...
@@ -37,7 +37,7 @@ def single_func(idx, resource):
...
@@ -37,7 +37,7 @@ def single_func(idx, resource):
for
line
in
fin
:
for
line
in
fin
:
dataset
.
append
(
line
.
strip
())
dataset
.
append
(
line
.
strip
())
if
args
.
request
==
"rpc"
:
if
args
.
request
==
"rpc"
:
reader
=
BertReader
(
vocab_file
=
"vocab.txt"
,
max_seq_len
=
20
)
reader
=
Chinese
BertReader
(
vocab_file
=
"vocab.txt"
,
max_seq_len
=
20
)
fetch
=
[
"pooled_output"
]
fetch
=
[
"pooled_output"
]
client
=
Client
()
client
=
Client
()
client
.
load_client_config
(
args
.
model
)
client
.
load_client_config
(
args
.
model
)
...
...
python/examples/bert/bert_web_service.py
浏览文件 @
c500fcb3
...
@@ -14,14 +14,14 @@
...
@@ -14,14 +14,14 @@
# limitations under the License.
# limitations under the License.
# pylint: disable=doc-string-missing
# pylint: disable=doc-string-missing
from
paddle_serving_server_gpu.web_service
import
WebService
from
paddle_serving_server_gpu.web_service
import
WebService
from
bert_reader
import
BertReader
from
paddle_serving_app.reader
import
Chinese
BertReader
import
sys
import
sys
import
os
import
os
class
BertService
(
WebService
):
class
BertService
(
WebService
):
def
load
(
self
):
def
load
(
self
):
self
.
reader
=
BertReader
(
vocab_file
=
"vocab.txt"
,
max_seq_len
=
128
)
self
.
reader
=
Chinese
BertReader
(
vocab_file
=
"vocab.txt"
,
max_seq_len
=
128
)
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
feed_res
=
[
feed_res
=
[
...
@@ -37,5 +37,5 @@ gpu_ids = os.environ["CUDA_VISIBLE_DEVICES"]
...
@@ -37,5 +37,5 @@ gpu_ids = os.environ["CUDA_VISIBLE_DEVICES"]
bert_service
.
set_gpus
(
gpu_ids
)
bert_service
.
set_gpus
(
gpu_ids
)
bert_service
.
prepare_server
(
bert_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
int
(
sys
.
argv
[
2
]),
device
=
"gpu"
)
workdir
=
"workdir"
,
port
=
int
(
sys
.
argv
[
2
]),
device
=
"gpu"
)
bert_service
.
run_
server
()
bert_service
.
run_
rpc_service
()
bert_service
.
run_
flask
()
bert_service
.
run_
web_service
()
python/examples/imagenet/resnet50_web_service.py
浏览文件 @
c500fcb3
...
@@ -68,5 +68,5 @@ if device == "gpu":
...
@@ -68,5 +68,5 @@ if device == "gpu":
image_service
.
set_gpus
(
"0,1"
)
image_service
.
set_gpus
(
"0,1"
)
image_service
.
prepare_server
(
image_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
int
(
sys
.
argv
[
3
]),
device
=
device
)
workdir
=
"workdir"
,
port
=
int
(
sys
.
argv
[
3
]),
device
=
device
)
image_service
.
run_
server
()
image_service
.
run_
rpc_service
()
image_service
.
run_
flask
()
image_service
.
run_
web_service
()
python/examples/imdb/text_classify_service.py
浏览文件 @
c500fcb3
...
@@ -37,5 +37,5 @@ imdb_service.load_model_config(sys.argv[1])
...
@@ -37,5 +37,5 @@ imdb_service.load_model_config(sys.argv[1])
imdb_service
.
prepare_server
(
imdb_service
.
prepare_server
(
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
imdb_service
.
prepare_dict
({
"dict_file_path"
:
sys
.
argv
[
4
]})
imdb_service
.
prepare_dict
({
"dict_file_path"
:
sys
.
argv
[
4
]})
imdb_service
.
run_
server
()
imdb_service
.
run_
rpc_service
()
imdb_service
.
run_
flask
()
imdb_service
.
run_
web_service
()
python/examples/lac/benchmark.py
浏览文件 @
c500fcb3
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
import
sys
import
sys
import
time
import
time
import
requests
import
requests
from
lac_
reader
import
LACReader
from
paddle_serving_app.
reader
import
LACReader
from
paddle_serving_client
import
Client
from
paddle_serving_client
import
Client
from
paddle_serving_client.utils
import
MultiThreadRunner
from
paddle_serving_client.utils
import
MultiThreadRunner
from
paddle_serving_client.utils
import
benchmark_args
from
paddle_serving_client.utils
import
benchmark_args
...
...
python/examples/lac/lac_client.py
浏览文件 @
c500fcb3
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
# pylint: disable=doc-string-missing
# pylint: disable=doc-string-missing
from
paddle_serving_client
import
Client
from
paddle_serving_client
import
Client
from
lac_
reader
import
LACReader
from
paddle_serving_app.
reader
import
LACReader
import
sys
import
sys
import
os
import
os
import
io
import
io
...
...
python/examples/lac/lac_web_service.py
浏览文件 @
c500fcb3
...
@@ -47,5 +47,5 @@ lac_service.load_model_config(sys.argv[1])
...
@@ -47,5 +47,5 @@ lac_service.load_model_config(sys.argv[1])
lac_service
.
load_reader
()
lac_service
.
load_reader
()
lac_service
.
prepare_server
(
lac_service
.
prepare_server
(
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
lac_service
.
run_
server
()
lac_service
.
run_
rpc_service
()
lac_service
.
run_
flask
()
lac_service
.
run_
web_service
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录