Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
79415712
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
79415712
编写于
5月 18, 2021
作者:
T
Thunderbrook
提交者:
GitHub
5月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support save multi sparse table in one path (#31108) (#31125)
* save multi table one path * format
上级
3a0d7f1a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
0 deletion
+44
-0
paddle/fluid/framework/fleet/fleet_wrapper.cc
paddle/fluid/framework/fleet/fleet_wrapper.cc
+18
-0
paddle/fluid/framework/fleet/fleet_wrapper.h
paddle/fluid/framework/fleet/fleet_wrapper.h
+2
-0
paddle/fluid/pybind/fleet_wrapper_py.cc
paddle/fluid/pybind/fleet_wrapper_py.cc
+2
-0
python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py
...e/fluid/incubate/fleet/parameter_server/pslib/__init__.py
+22
-0
未找到文件。
paddle/fluid/framework/fleet/fleet_wrapper.cc
浏览文件 @
79415712
...
@@ -917,6 +917,24 @@ void FleetWrapper::LoadWithWhitelist(const uint64_t table_id,
...
@@ -917,6 +917,24 @@ void FleetWrapper::LoadWithWhitelist(const uint64_t table_id,
#endif
#endif
}
}
void
FleetWrapper
::
SaveMultiTableOnePath
(
const
std
::
vector
<
int
>&
table_ids
,
const
std
::
string
&
path
,
const
int
mode
)
{
#ifdef PADDLE_WITH_PSLIB
auto
ret
=
pslib_ptr_
->
_worker_ptr
->
save_multi_table_one_path
(
table_ids
,
path
,
std
::
to_string
(
mode
));
ret
.
wait
();
int32_t
feasign_cnt
=
ret
.
get
();
if
(
feasign_cnt
==
-
1
)
{
LOG
(
ERROR
)
<<
"save model failed"
;
sleep
(
sleep_seconds_before_fail_exit_
);
exit
(
-
1
);
}
#else
VLOG
(
0
)
<<
"FleetWrapper::SaveMultiTableOnePath does nothing when no pslib"
;
#endif
}
void
FleetWrapper
::
SaveModel
(
const
std
::
string
&
path
,
const
int
mode
)
{
void
FleetWrapper
::
SaveModel
(
const
std
::
string
&
path
,
const
int
mode
)
{
#ifdef PADDLE_WITH_PSLIB
#ifdef PADDLE_WITH_PSLIB
auto
ret
=
pslib_ptr_
->
_worker_ptr
->
save
(
path
,
std
::
to_string
(
mode
));
auto
ret
=
pslib_ptr_
->
_worker_ptr
->
save
(
path
,
std
::
to_string
(
mode
));
...
...
paddle/fluid/framework/fleet/fleet_wrapper.h
浏览文件 @
79415712
...
@@ -230,6 +230,8 @@ class FleetWrapper {
...
@@ -230,6 +230,8 @@ class FleetWrapper {
// mode = 0, save all feature
// mode = 0, save all feature
// mode = 1, save delta feature, which means save diff
// mode = 1, save delta feature, which means save diff
void
SaveModel
(
const
std
::
string
&
path
,
const
int
mode
);
void
SaveModel
(
const
std
::
string
&
path
,
const
int
mode
);
void
SaveMultiTableOnePath
(
const
std
::
vector
<
int
>&
table_ids
,
const
std
::
string
&
path
,
const
int
mode
);
// mode = 0, save all feature
// mode = 0, save all feature
// mode = 1, save delta feature, which means save diff
// mode = 1, save delta feature, which means save diff
void
SaveModelOneTable
(
const
uint64_t
table_id
,
const
std
::
string
&
path
,
void
SaveModelOneTable
(
const
uint64_t
table_id
,
const
std
::
string
&
path
,
...
...
paddle/fluid/pybind/fleet_wrapper_py.cc
浏览文件 @
79415712
...
@@ -57,6 +57,8 @@ void BindFleetWrapper(py::module* m) {
...
@@ -57,6 +57,8 @@ void BindFleetWrapper(py::module* m) {
.
def
(
"get_cache_threshold"
,
&
framework
::
FleetWrapper
::
GetCacheThreshold
)
.
def
(
"get_cache_threshold"
,
&
framework
::
FleetWrapper
::
GetCacheThreshold
)
.
def
(
"cache_shuffle"
,
&
framework
::
FleetWrapper
::
CacheShuffle
)
.
def
(
"cache_shuffle"
,
&
framework
::
FleetWrapper
::
CacheShuffle
)
.
def
(
"save_cache"
,
&
framework
::
FleetWrapper
::
SaveCache
)
.
def
(
"save_cache"
,
&
framework
::
FleetWrapper
::
SaveCache
)
.
def
(
"save_multi_table_one_path"
,
&
framework
::
FleetWrapper
::
SaveMultiTableOnePath
)
.
def
(
"save_model_with_whitelist"
,
.
def
(
"save_model_with_whitelist"
,
&
framework
::
FleetWrapper
::
SaveWithWhitelist
)
&
framework
::
FleetWrapper
::
SaveWithWhitelist
)
.
def
(
"load_model"
,
&
framework
::
FleetWrapper
::
LoadModel
)
.
def
(
"load_model"
,
&
framework
::
FleetWrapper
::
LoadModel
)
...
...
python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py
浏览文件 @
79415712
...
@@ -333,6 +333,28 @@ class PSLib(Fleet):
...
@@ -333,6 +333,28 @@ class PSLib(Fleet):
whitelist_path
)
whitelist_path
)
self
.
_role_maker
.
_barrier_worker
()
self
.
_role_maker
.
_barrier_worker
()
def
save_multi_table_one_path
(
self
,
table_ids
,
model_dir
,
**
kwargs
):
"""
save pslib multi sparse table in one path.
Args:
table_ids(list): table ids
model_dir(str): if you use hdfs, model_dir should starts with
'hdfs:', otherwise means local dir
kwargs(dict): user-defined properties.
mode(int): the modes illustrated above, default 0
prefix(str): the parts to save can have prefix,
for example, part-prefix-000-00000
Examples:
.. code-block:: python
fleet.save_multi_table_one_path("[0, 1]", "afs:/user/path/")
"""
mode
=
kwargs
.
get
(
"mode"
,
0
)
self
.
_role_maker
.
_barrier_worker
()
if
self
.
_role_maker
.
is_first_worker
():
self
.
_fleet_ptr
.
save_multi_table_one_path
(
table_ids
,
model_dir
,
mode
)
self
.
_role_maker
.
_barrier_worker
()
def
save_cache_model
(
self
,
executor
,
dirname
,
main_program
=
None
,
**
kwargs
):
def
save_cache_model
(
self
,
executor
,
dirname
,
main_program
=
None
,
**
kwargs
):
"""
"""
save sparse cache table,
save sparse cache table,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录