Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
051eaa5f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
051eaa5f
编写于
8月 14, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ditriubted attrs
上级
057a6450
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
9 deletion
+17
-9
python/paddle/fluid/io.py
python/paddle/fluid/io.py
+8
-6
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+9
-3
未找到文件。
python/paddle/fluid/io.py
浏览文件 @
051eaa5f
...
...
@@ -733,6 +733,9 @@ def load_inference_model(dirname,
if
not
os
.
path
.
isdir
(
dirname
):
raise
ValueError
(
"There is no directory named '%s'"
,
dirname
)
if
training_role
==
"PSERVER"
:
_load_lookup_table_vars
(
executor
,
dirname
,
program
,
role_id
)
if
model_filename
is
not
None
:
model_filename
=
os
.
path
.
basename
(
model_filename
)
else
:
...
...
@@ -749,10 +752,7 @@ def load_inference_model(dirname,
load_persistables
(
executor
,
dirname
,
program
,
params_filename
)
if
pserver_endpoints
:
_endpoints_replacement
(
program
,
pserver_endpoints
)
if
training_role
==
"PSERVER"
:
_load_lookup_table_vars
(
executor
,
dirname
,
program
,
role_id
)
program
=
_endpoints_replacement
(
program
,
pserver_endpoints
)
feed_target_names
=
program
.
desc
.
get_feed_target_names
()
fetch_target_names
=
program
.
desc
.
get_fetch_target_names
()
...
...
@@ -871,8 +871,10 @@ def _load_lookup_table_vars(executor, dirname, program, pserver_id):
def
_endpoints_replacement
(
program
,
endpoints
):
ENDPOINT_MAP
=
"epmap"
for
op
in
program
.
global_block
().
ops
:
if
op
.
attrs
.
has_key
(
ENDPOINT_MAP
):
op
.
attrs
[
ENDPOINT_MAP
]
=
endpoints
if
op
.
has_attr
(
ENDPOINT_MAP
):
op
.
set_attr
(
ENDPOINT_MAP
,
endpoints
)
program
=
program
.
clone
()
return
program
def
get_parameter_value
(
para
,
executor
):
...
...
python/paddle/fluid/transpiler/distribute_transpiler.py
浏览文件 @
051eaa5f
...
...
@@ -501,6 +501,8 @@ class DistributeTranspiler(object):
checkpoint_block_id
=
self
.
_create_checkpoint_save_block
(
pserver_program
,
table_opt_block
.
idx
)
pserver_program
.
_distributed_lookup_table
=
self
.
table_name
# NOTE: if has_distributed_lookup_table is False, then prefetch_block will
# not be executed, so it's safe to use optimize_block to hold the place
if
self
.
has_distributed_lookup_table
:
...
...
@@ -527,9 +529,13 @@ class DistributeTranspiler(object):
outputs
=
{},
attrs
=
attrs
)
# add slice vars
slice_vars_and_atts
=
self
.
_get_slice_vars_and_atts
(
endpoint
)
pserver_program
.
_slice_vars_and_atts
=
slice_vars_and_atts
# add distributed attrs
pserver_program
.
_slice_vars_and_atts
=
self
.
_get_slice_vars_and_atts
(
endpoint
)
pserver_program
.
_is_distributed
=
True
pserver_program
.
_endpoints
=
self
.
pserver_endpoints
pserver_program
.
_is_chief
=
self
.
trainer_id
==
0
pserver_program
.
_distributed_lookup_table
=
self
.
table_name
if
self
.
table_name
else
None
pserver_program
.
_sync_with_cpp
()
return
pserver_program
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录