Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
9e68dfcb
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看板
未验证
提交
9e68dfcb
编写于
10月 14, 2021
作者:
S
ShiningZhang
提交者:
GitHub
10月 14, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into dev-bug
上级
fbe56c70
1861cebe
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
40 addition
and
12 deletion
+40
-12
core/general-server/op/general_dist_kv_infer_op.cpp
core/general-server/op/general_dist_kv_infer_op.cpp
+3
-3
core/predictor/framework/infer.h
core/predictor/framework/infer.h
+2
-2
python/examples/criteo_ctr_with_cube/cube/conf/cube.conf
python/examples/criteo_ctr_with_cube/cube/conf/cube.conf
+13
-0
python/examples/criteo_ctr_with_cube/cube/conf/gflags.conf
python/examples/criteo_ctr_with_cube/cube/conf/gflags.conf
+4
-0
python/examples/criteo_ctr_with_cube/cube/keys
python/examples/criteo_ctr_with_cube/cube/keys
+10
-0
python/examples/criteo_ctr_with_cube/test_client.py
python/examples/criteo_ctr_with_cube/test_client.py
+7
-6
python/examples/pipeline/PaddleDetection/faster_rcnn/web_service.py
...mples/pipeline/PaddleDetection/faster_rcnn/web_service.py
+1
-1
未找到文件。
core/general-server/op/general_dist_kv_infer_op.cpp
浏览文件 @
9e68dfcb
...
@@ -186,9 +186,9 @@ int GeneralDistKVInferOp::inference() {
...
@@ -186,9 +186,9 @@ int GeneralDistKVInferOp::inference() {
if
(
values
.
size
()
!=
keys
.
size
()
||
values
[
0
].
buff
.
size
()
==
0
)
{
if
(
values
.
size
()
!=
keys
.
size
()
||
values
[
0
].
buff
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"cube value return null"
;
LOG
(
ERROR
)
<<
"cube value return null"
;
}
}
//
size_t EMBEDDING_SIZE = values[0].buff.size() / sizeof(float);
size_t
EMBEDDING_SIZE
=
values
[
0
].
buff
.
size
()
/
sizeof
(
float
);
// size_t EMBEDDING_SIZE = (values[0].buff.size() - 10) / sizeof(float);
// size_t EMBEDDING_SIZE = (values[0].buff.size() - 10) / sizeof(float);
size_t
EMBEDDING_SIZE
=
9
;
//
size_t EMBEDDING_SIZE = 9;
TensorVector
sparse_out
;
TensorVector
sparse_out
;
sparse_out
.
resize
(
sparse_count
);
sparse_out
.
resize
(
sparse_count
);
TensorVector
dense_out
;
TensorVector
dense_out
;
...
@@ -241,7 +241,7 @@ int GeneralDistKVInferOp::inference() {
...
@@ -241,7 +241,7 @@ int GeneralDistKVInferOp::inference() {
// The data generated by pslib has 10 bytes of information to be filtered
// The data generated by pslib has 10 bytes of information to be filtered
// out
// out
memcpy
(
data_ptr
,
cur_val
->
buff
.
data
()
+
10
,
cur_val
->
buff
.
size
()
-
10
);
memcpy
(
data_ptr
,
cur_val
->
buff
.
data
()
,
cur_val
->
buff
.
size
()
);
// VLOG(3) << keys[cube_val_idx] << ":" << data_ptr[0] << ", " <<
// VLOG(3) << keys[cube_val_idx] << ":" << data_ptr[0] << ", " <<
// data_ptr[1] << ", " <<data_ptr[2] << ", " <<data_ptr[3] << ", "
// data_ptr[1] << ", " <<data_ptr[2] << ", " <<data_ptr[3] << ", "
// <<data_ptr[4] << ", " <<data_ptr[5] << ", " <<data_ptr[6] << ", "
// <<data_ptr[4] << ", " <<data_ptr[5] << ", " <<data_ptr[6] << ", "
...
...
core/predictor/framework/infer.h
浏览文件 @
9e68dfcb
...
@@ -277,7 +277,7 @@ class DBReloadableInferEngine : public ReloadableInferEngine {
...
@@ -277,7 +277,7 @@ class DBReloadableInferEngine : public ReloadableInferEngine {
LOG
(
WARNING
)
<<
"Loading cube cache["
<<
next_idx
<<
"] ..."
;
LOG
(
WARNING
)
<<
"Loading cube cache["
<<
next_idx
<<
"] ..."
;
std
::
string
model_path
=
conf
.
model_dir
();
std
::
string
model_path
=
conf
.
model_dir
();
if
(
access
(
model_path
.
c_str
(),
F_OK
)
==
0
)
{
if
(
access
(
model_path
.
c_str
(),
F_OK
)
==
0
)
{
std
::
string
cube_cache_path
=
model_path
+
"/
"
+
"
cube_cache"
;
std
::
string
cube_cache_path
=
model_path
+
"/cube_cache"
;
int
reload_cache_ret
=
md
->
caches
[
next_idx
]
->
reload_data
(
cube_cache_path
);
int
reload_cache_ret
=
md
->
caches
[
next_idx
]
->
reload_data
(
cube_cache_path
);
LOG
(
WARNING
)
<<
"Loading cube cache["
<<
next_idx
<<
"] done."
;
LOG
(
WARNING
)
<<
"Loading cube cache["
<<
next_idx
<<
"] done."
;
}
else
{
}
else
{
...
@@ -437,7 +437,7 @@ class CloneDBReloadableInferEngine
...
@@ -437,7 +437,7 @@ class CloneDBReloadableInferEngine
// create caches
// create caches
std
::
string
model_path
=
conf
.
model_dir
();
std
::
string
model_path
=
conf
.
model_dir
();
if
(
access
(
model_path
.
c_str
(),
F_OK
)
==
0
)
{
if
(
access
(
model_path
.
c_str
(),
F_OK
)
==
0
)
{
std
::
string
cube_cache_path
=
model_path
+
"cube_cache"
;
std
::
string
cube_cache_path
=
model_path
+
"
/
cube_cache"
;
int
reload_cache_ret
=
int
reload_cache_ret
=
md
->
caches
[
next_idx
]
->
reload_data
(
cube_cache_path
);
md
->
caches
[
next_idx
]
->
reload_data
(
cube_cache_path
);
LOG
(
WARNING
)
<<
"create cube cache["
<<
next_idx
<<
"] done."
;
LOG
(
WARNING
)
<<
"create cube cache["
<<
next_idx
<<
"] done."
;
...
...
python/examples/criteo_ctr_with_cube/cube/conf/cube.conf
0 → 100755
浏览文件 @
9e68dfcb
[{
"dict_name"
:
"test_dict"
,
"shard"
:
1
,
"dup"
:
1
,
"timeout"
:
200
,
"retry"
:
3
,
"backup_request"
:
100
,
"type"
:
"ipport_list"
,
"load_balancer"
:
"rr"
,
"nodes"
: [{
"ipport_list"
:
"list://127.0.0.1:8027"
}]
}]
python/examples/criteo_ctr_with_cube/cube/conf/gflags.conf
0 → 100755
浏览文件 @
9e68dfcb
--
port
=
8027
--
dict_split
=
1
--
in_mem
=
true
--
log_dir
=./
log
/
python/examples/criteo_ctr_with_cube/cube/keys
0 → 100755
浏览文件 @
9e68dfcb
1
2
3
4
5
6
7
8
9
10
python/examples/criteo_ctr_with_cube/test_client.py
浏览文件 @
9e68dfcb
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
from
paddle_serving_client
import
Client
from
paddle_serving_client
import
Client
import
sys
import
sys
import
os
import
os
import
criteo
as
criteo
import
criteo
_reader
as
criteo
import
time
import
time
from
paddle_serving_client.metric
import
auc
from
paddle_serving_client.metric
import
auc
import
numpy
as
np
import
numpy
as
np
...
@@ -35,22 +35,23 @@ reader = dataset.infer_reader(test_filelists, batch, buf_size)
...
@@ -35,22 +35,23 @@ reader = dataset.infer_reader(test_filelists, batch, buf_size)
label_list
=
[]
label_list
=
[]
prob_list
=
[]
prob_list
=
[]
start
=
time
.
time
()
start
=
time
.
time
()
for
ei
in
range
(
100
00
):
for
ei
in
range
(
100
):
if
py_version
==
2
:
if
py_version
==
2
:
data
=
reader
().
next
()
data
=
reader
().
next
()
else
:
else
:
data
=
reader
().
__next__
()
data
=
reader
().
__next__
()
feed_dict
=
{}
feed_dict
=
{}
feed_dict
[
'dense_input'
]
=
data
[
0
][
0
]
feed_dict
[
'dense_input'
]
=
np
.
array
(
data
[
0
][
0
]).
reshape
(
1
,
len
(
data
[
0
][
0
]))
for
i
in
range
(
1
,
27
):
for
i
in
range
(
1
,
27
):
feed_dict
[
"embedding_{}.tmp_0"
.
format
(
i
-
1
)]
=
np
.
array
(
data
[
0
][
i
]).
reshape
(
-
1
)
feed_dict
[
"embedding_{}.tmp_0"
.
format
(
i
-
1
)]
=
np
.
array
(
data
[
0
][
i
]).
reshape
(
len
(
data
[
0
][
i
])
)
feed_dict
[
"embedding_{}.tmp_0.lod"
.
format
(
i
-
1
)]
=
[
0
,
len
(
data
[
0
][
i
])]
feed_dict
[
"embedding_{}.tmp_0.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"
]
,
batch
=
True
)
print
(
fetch_map
)
print
(
fetch_map
)
prob_list
.
append
(
fetch_map
[
'prob'
][
0
][
1
])
prob_list
.
append
(
fetch_map
[
'prob'
][
0
][
1
])
label_list
.
append
(
data
[
0
][
-
1
][
0
])
label_list
.
append
(
data
[
0
][
-
1
][
0
])
print
(
auc
(
label_list
,
prob_list
))
end
=
time
.
time
()
end
=
time
.
time
()
print
(
end
-
start
)
print
(
end
-
start
)
python/examples/pipeline/PaddleDetection/faster_rcnn/web_service.py
浏览文件 @
9e68dfcb
...
@@ -25,7 +25,7 @@ class FasterRCNNOp(Op):
...
@@ -25,7 +25,7 @@ class FasterRCNNOp(Op):
self
.
img_preprocess
=
Sequential
([
self
.
img_preprocess
=
Sequential
([
BGR2RGB
(),
Div
(
255.0
),
BGR2RGB
(),
Div
(
255.0
),
Normalize
([
0.485
,
0.456
,
0.406
],
[
0.229
,
0.224
,
0.225
],
False
),
Normalize
([
0.485
,
0.456
,
0.406
],
[
0.229
,
0.224
,
0.225
],
False
),
Resize
(
(
640
,
640
)
),
Transpose
((
2
,
0
,
1
))
Resize
(
640
,
640
),
Transpose
((
2
,
0
,
1
))
])
])
self
.
img_postprocess
=
RCNNPostprocess
(
"label_list.txt"
,
"output"
)
self
.
img_postprocess
=
RCNNPostprocess
(
"label_list.txt"
,
"output"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录