Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
c3eaa149
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看板
提交
c3eaa149
编写于
11月 03, 2020
作者:
W
wangjiawei04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for iPipe2
上级
57d5ca2d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
24 addition
and
18 deletion
+24
-18
python/examples/bert/bert_client.py
python/examples/bert/bert_client.py
+0
-3
python/examples/criteo_ctr/test_client.py
python/examples/criteo_ctr/test_client.py
+3
-2
python/examples/faster_rcnn_model/test_client.py
python/examples/faster_rcnn_model/test_client.py
+1
-1
python/examples/fit_a_line/test_client.py
python/examples/fit_a_line/test_client.py
+1
-3
python/examples/imdb/benchmark.py
python/examples/imdb/benchmark.py
+7
-4
python/examples/pipeline/imdb_model_ensemble/config.yml
python/examples/pipeline/imdb_model_ensemble/config.yml
+9
-1
python/examples/yolov4/test_client.py
python/examples/yolov4/test_client.py
+1
-1
python/pipeline/operator.py
python/pipeline/operator.py
+2
-3
未找到文件。
python/examples/bert/bert_client.py
浏览文件 @
c3eaa149
...
@@ -34,7 +34,4 @@ for line in sys.stdin:
...
@@ -34,7 +34,4 @@ for line in sys.stdin:
feed_dict
[
key
]
=
np
.
array
(
feed_dict
[
key
]).
reshape
((
128
,
1
))
feed_dict
[
key
]
=
np
.
array
(
feed_dict
[
key
]).
reshape
((
128
,
1
))
#print(feed_dict)
#print(feed_dict)
result
=
client
.
predict
(
feed
=
feed_dict
,
fetch
=
fetch
)
result
=
client
.
predict
(
feed
=
feed_dict
,
fetch
=
fetch
)
print
(
result
)
print
(
result
)
print
(
result
)
print
(
result
)
print
(
result
)
python/examples/criteo_ctr/test_client.py
浏览文件 @
c3eaa149
...
@@ -20,7 +20,7 @@ import os
...
@@ -20,7 +20,7 @@ import os
import
time
import
time
import
criteo_reader
as
criteo
import
criteo_reader
as
criteo
from
paddle_serving_client.metric
import
auc
from
paddle_serving_client.metric
import
auc
import
numpy
as
np
import
sys
import
sys
py_version
=
sys
.
version_info
[
0
]
py_version
=
sys
.
version_info
[
0
]
...
@@ -49,7 +49,8 @@ for ei in range(1000):
...
@@ -49,7 +49,8 @@ for ei in range(1000):
data
=
reader
().
__next__
()
data
=
reader
().
__next__
()
feed_dict
=
{}
feed_dict
=
{}
for
i
in
range
(
1
,
27
):
for
i
in
range
(
1
,
27
):
feed_dict
[
"sparse_{}"
.
format
(
i
-
1
)]
=
data
[
0
][
i
]
feed_dict
[
"sparse_{}"
.
format
(
i
-
1
)]
=
np
.
array
(
data
[
0
][
i
]).
reshape
(
-
1
)
feed_dict
[
"sparse_{}.lod"
.
format
(
i
-
1
)]
=
[
0
,
len
(
data
[
0
][
i
])]
fetch_map
=
client
.
predict
(
feed
=
feed_dict
,
fetch
=
[
"prob"
])
fetch_map
=
client
.
predict
(
feed
=
feed_dict
,
fetch
=
[
"prob"
])
end
=
time
.
time
()
end
=
time
.
time
()
print
(
end
-
start
)
print
(
end
-
start
)
python/examples/faster_rcnn_model/test_client.py
浏览文件 @
c3eaa149
...
@@ -36,6 +36,6 @@ fetch_map = client.predict(
...
@@ -36,6 +36,6 @@ fetch_map = client.predict(
"im_info"
:
np
.
array
(
list
(
im
.
shape
[
1
:])
+
[
1.0
]),
"im_info"
:
np
.
array
(
list
(
im
.
shape
[
1
:])
+
[
1.0
]),
"im_shape"
:
np
.
array
(
list
(
im
.
shape
[
1
:])
+
[
1.0
])
"im_shape"
:
np
.
array
(
list
(
im
.
shape
[
1
:])
+
[
1.0
])
},
},
fetch
=
[
"multiclass_nms"
])
fetch
=
[
"multiclass_nms"
]
,
batch
=
False
)
fetch_map
[
"image"
]
=
sys
.
argv
[
3
]
fetch_map
[
"image"
]
=
sys
.
argv
[
3
]
postprocess
(
fetch_map
)
postprocess
(
fetch_map
)
python/examples/fit_a_line/test_client.py
浏览文件 @
c3eaa149
...
@@ -28,10 +28,8 @@ test_reader = paddle.batch(
...
@@ -28,10 +28,8 @@ test_reader = paddle.batch(
for
data
in
test_reader
():
for
data
in
test_reader
():
import
numpy
as
np
import
numpy
as
np
new_data
=
np
.
zeros
((
2
,
1
,
13
)).
astype
(
"float32"
)
new_data
=
np
.
zeros
((
1
,
1
,
13
)).
astype
(
"float32"
)
new_data
[
0
]
=
data
[
0
][
0
]
new_data
[
0
]
=
data
[
0
][
0
]
new_data
[
1
]
=
data
[
0
][
0
]
print
(
new_data
)
fetch_map
=
client
.
predict
(
fetch_map
=
client
.
predict
(
feed
=
{
"x"
:
new_data
},
fetch
=
[
"price"
],
batch
=
True
)
feed
=
{
"x"
:
new_data
},
fetch
=
[
"price"
],
batch
=
True
)
print
(
"{} {}"
.
format
(
fetch_map
[
"price"
][
0
],
data
[
0
][
1
][
0
]))
print
(
"{} {}"
.
format
(
fetch_map
[
"price"
][
0
],
data
[
0
][
1
][
0
]))
...
...
python/examples/imdb/benchmark.py
浏览文件 @
c3eaa149
...
@@ -17,6 +17,7 @@ import os
...
@@ -17,6 +17,7 @@ import os
import
sys
import
sys
import
time
import
time
import
requests
import
requests
import
numpy
as
np
from
paddle_serving_app.reader
import
IMDBDataset
from
paddle_serving_app.reader
import
IMDBDataset
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
...
@@ -47,11 +48,13 @@ def single_func(idx, resource):
...
@@ -47,11 +48,13 @@ def single_func(idx, resource):
for
i
in
range
(
1000
):
for
i
in
range
(
1000
):
if
args
.
batch_size
>=
1
:
if
args
.
batch_size
>=
1
:
feed_batch
=
[]
feed_batch
=
[]
feed
=
{
"words"
:
[],
"words.lod"
:[
0
]}
for
bi
in
range
(
args
.
batch_size
):
for
bi
in
range
(
args
.
batch_size
):
word_ids
,
label
=
imdb_dataset
.
get_words_and_label
(
dataset
[
word_ids
,
label
=
imdb_dataset
.
get_words_and_label
(
dataset
[
bi
])
bi
])
feed
[
"words.lod"
].
append
(
feed
[
"words.lod"
][
-
1
]
+
len
(
word_ids
))
feed_batch
.
append
({
"words"
:
word_ids
})
feed
[
"words"
].
extend
(
word_ids
)
result
=
client
.
predict
(
feed
=
feed_batch
,
fetch
=
[
"prediction"
])
feed
[
"words"
]
=
np
.
array
(
feed
[
"words"
]).
reshape
(
len
(
feed
[
"words"
]),
1
)
result
=
client
.
predict
(
feed
=
feed
,
fetch
=
[
"prediction"
],
batch
=
True
)
if
result
is
None
:
if
result
is
None
:
raise
(
"predict failed."
)
raise
(
"predict failed."
)
else
:
else
:
...
...
python/examples/pipeline/imdb_model_ensemble/config.yml
浏览文件 @
c3eaa149
...
@@ -10,5 +10,13 @@ op:
...
@@ -10,5 +10,13 @@ op:
concurrency
:
2
concurrency
:
2
remote_service_conf
:
remote_service_conf
:
client_type
:
brpc
client_type
:
brpc
model_config
:
ocr_det
_model
model_config
:
imdb_bow
_model
devices
:
"
"
devices
:
"
"
rpc_port
:
9393
cnn
:
concurrency
:
2
remote_service_conf
:
client_type
:
brpc
model_config
:
imdb_cnn_model
devices
:
"
"
rpc_port
:
9292
python/examples/yolov4/test_client.py
浏览文件 @
c3eaa149
...
@@ -35,6 +35,6 @@ fetch_map = client.predict(
...
@@ -35,6 +35,6 @@ fetch_map = client.predict(
"image"
:
im
,
"image"
:
im
,
"im_size"
:
np
.
array
(
list
(
im
.
shape
[
1
:])),
"im_size"
:
np
.
array
(
list
(
im
.
shape
[
1
:])),
},
},
fetch
=
[
"save_infer_model/scale_0.tmp_0"
])
fetch
=
[
"save_infer_model/scale_0.tmp_0"
]
,
batch
=
False
)
fetch_map
[
"image"
]
=
sys
.
argv
[
1
]
fetch_map
[
"image"
]
=
sys
.
argv
[
1
]
postprocess
(
fetch_map
)
postprocess
(
fetch_map
)
python/pipeline/operator.py
浏览文件 @
c3eaa149
...
@@ -835,8 +835,7 @@ class Op(object):
...
@@ -835,8 +835,7 @@ class Op(object):
self
.
concurrency_idx
=
None
self
.
concurrency_idx
=
None
# init client
# init client
self
.
client
=
self
.
init_client
(
self
.
_client_config
,
self
.
client
=
self
.
init_client
(
self
.
_client_config
,
self
.
_server_endpoints
,
self
.
_server_endpoints
)
self
.
_fetch_names
)
# user defined
# user defined
self
.
init_op
()
self
.
init_op
()
self
.
_succ_init_op
=
True
self
.
_succ_init_op
=
True
...
@@ -845,7 +844,7 @@ class Op(object):
...
@@ -845,7 +844,7 @@ class Op(object):
self
.
concurrency_idx
=
concurrency_idx
self
.
concurrency_idx
=
concurrency_idx
# init client
# init client
self
.
client
=
self
.
init_client
(
self
.
client
=
self
.
init_client
(
self
.
_client_config
,
self
.
_server_endpoints
,
self
.
_fetch_names
)
self
.
_client_config
,
self
.
_server_endpoints
)
# user defined
# user defined
self
.
init_op
()
self
.
init_op
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录