Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
8af92bb4
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看板
提交
8af92bb4
编写于
7月 30, 2020
作者:
B
barriery
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update demo
上级
6e07a3fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
11 deletion
+24
-11
python/examples/pipeline/imdb_model_ensemble/config.yml
python/examples/pipeline/imdb_model_ensemble/config.yml
+2
-2
python/examples/pipeline/imdb_model_ensemble/test_pipeline_client.py
...ples/pipeline/imdb_model_ensemble/test_pipeline_client.py
+7
-3
python/examples/pipeline/imdb_model_ensemble/test_pipeline_server.py
...ples/pipeline/imdb_model_ensemble/test_pipeline_server.py
+15
-6
未找到文件。
python/examples/pipeline/imdb_model_ensemble/config.yml
浏览文件 @
8af92bb4
port
:
18080
worker_num
:
1
worker_num
:
4
build_dag_each_worker
:
false
dag
:
is_thread_op
:
tru
e
is_thread_op
:
fals
e
client_type
:
brpc
retry
:
1
use_profile
:
false
python/examples/pipeline/imdb_model_ensemble/test_pipeline_client.py
浏览文件 @
8af92bb4
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle_serving_
client
.pipeline
import
PipelineClient
from
paddle_serving_
server_gpu
.pipeline
import
PipelineClient
import
numpy
as
np
client
=
PipelineClient
()
...
...
@@ -20,12 +20,16 @@ client.connect(['127.0.0.1:18080'])
words
=
'i am very sad | 0'
futures
=
[]
for
i
in
range
(
100
):
for
i
in
range
(
4
):
futures
.
append
(
client
.
predict
(
feed_dict
=
{
"words"
:
words
},
fetch
=
[
"prediction"
],
asyn
=
True
))
feed_dict
=
{
"words"
:
words
},
fetch
=
[
"prediction"
],
asyn
=
True
,
profile
=
False
))
for
f
in
futures
:
res
=
f
.
result
()
if
res
[
"ecode"
]
!=
0
:
print
(
"predict failed: {}"
.
format
(
res
))
print
(
res
)
python/examples/pipeline/imdb_model_ensemble/test_pipeline_server.py
浏览文件 @
8af92bb4
...
...
@@ -14,8 +14,9 @@
# pylint: disable=doc-string-missing
import
logging
logging
.
basicConfig
(
format
=
'%(levelname)s:%(asctime)s:%(message)s'
,
level
=
logging
.
INFO
)
logging
.
basicConfig
(
format
=
"[%(process)d](%(threadName)s) %(levelname)s %(asctime)s [%(funcName)s:%(lineno)d] %(message)s"
,
level
=
logging
.
INFO
)
from
paddle_serving_server_gpu.pipeline
import
Op
,
RequestOp
,
ResponseOp
from
paddle_serving_server_gpu.pipeline
import
PipelineServer
...
...
@@ -26,6 +27,7 @@ from paddle_serving_app.reader import IMDBDataset
_LOGGER
=
logging
.
getLogger
()
class
ImdbRequestOp
(
RequestOp
):
def
init_op
(
self
):
self
.
imdb_dataset
=
IMDBDataset
()
...
...
@@ -51,6 +53,7 @@ class CombineOp(Op):
data
=
{
"prediction"
:
combined_prediction
/
2
}
return
data
class
ImdbResponseOp
(
ResponseOp
):
# Here ImdbResponseOp is consistent with the default ResponseOp implementation
def
pack_response_package
(
self
,
channeldata
):
...
...
@@ -75,7 +78,9 @@ bow_op = Op(name="bow",
client_config
=
"imdb_bow_client_conf/serving_client_conf.prototxt"
,
concurrency
=
1
,
timeout
=-
1
,
retry
=
1
)
retry
=
1
,
batch_size
=
3
,
auto_batching_timeout
=
1
)
cnn_op
=
Op
(
name
=
"cnn"
,
input_ops
=
[
read_op
],
server_endpoints
=
[
"127.0.0.1:9292"
],
...
...
@@ -83,13 +88,17 @@ cnn_op = Op(name="cnn",
client_config
=
"imdb_cnn_client_conf/serving_client_conf.prototxt"
,
concurrency
=
1
,
timeout
=-
1
,
retry
=
1
)
retry
=
1
,
batch_size
=
1
,
auto_batching_timeout
=
None
)
combine_op
=
CombineOp
(
name
=
"combine"
,
input_ops
=
[
bow_op
,
cnn_op
],
concurrency
=
5
,
concurrency
=
1
,
timeout
=-
1
,
retry
=
1
)
retry
=
1
,
batch_size
=
2
,
auto_batching_timeout
=
None
)
# fetch output of bow_op
# response_op = ImdbResponseOp(input_ops=[bow_op])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录