Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9dd25b46
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
9dd25b46
编写于
6月 21, 2019
作者:
H
hutuxian
提交者:
GitHub
6月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cherry-pick: fix errors in python3 (#18239) (#18243)
* fix relative import error in python3 * fix debug string info
上级
f7f54d39
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
1 deletion
+11
-1
python/paddle/fluid/executor.py
python/paddle/fluid/executor.py
+1
-1
python/paddle/fluid/trainer_desc.py
python/paddle/fluid/trainer_desc.py
+10
-0
未找到文件。
python/paddle/fluid/executor.py
浏览文件 @
9dd25b46
...
@@ -758,7 +758,7 @@ class Executor(object):
...
@@ -758,7 +758,7 @@ class Executor(object):
def
_dump_debug_info
(
self
,
program
=
None
,
trainer
=
None
):
def
_dump_debug_info
(
self
,
program
=
None
,
trainer
=
None
):
with
open
(
str
(
id
(
program
))
+
"_train_desc.prototxt"
,
"w"
)
as
fout
:
with
open
(
str
(
id
(
program
))
+
"_train_desc.prototxt"
,
"w"
)
as
fout
:
fout
.
write
(
trainer
.
_desc
(
))
fout
.
write
(
str
(
trainer
))
if
program
.
_fleet_opt
:
if
program
.
_fleet_opt
:
with
open
(
"fleet_desc.prototxt"
,
"w"
)
as
fout
:
with
open
(
"fleet_desc.prototxt"
,
"w"
)
as
fout
:
fout
.
write
(
str
(
program
.
_fleet_opt
[
"fleet_desc"
]))
fout
.
write
(
str
(
program
.
_fleet_opt
[
"fleet_desc"
]))
...
...
python/paddle/fluid/trainer_desc.py
浏览文件 @
9dd25b46
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
sys
from
os
import
path
__all__
=
[
'TrainerDesc'
,
'MultiTrainer'
,
'DistMultiTrainer'
,
'PipelineTrainer'
]
__all__
=
[
'TrainerDesc'
,
'MultiTrainer'
,
'DistMultiTrainer'
,
'PipelineTrainer'
]
...
@@ -23,6 +25,11 @@ class TrainerDesc(object):
...
@@ -23,6 +25,11 @@ class TrainerDesc(object):
with open(proto_file, 'r') as f:
with open(proto_file, 'r') as f:
text_format.Parse(f.read(), self.proto_desc)
text_format.Parse(f.read(), self.proto_desc)
'''
'''
# Workaround for relative import in protobuf under python3
# TODO: should be fixed
cur_path
=
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
cur_path
)
sys
.
path
.
append
(
cur_path
+
"/proto"
)
from
proto
import
trainer_desc_pb2
from
proto
import
trainer_desc_pb2
self
.
proto_desc
=
trainer_desc_pb2
.
TrainerDesc
()
self
.
proto_desc
=
trainer_desc_pb2
.
TrainerDesc
()
import
multiprocessing
as
mp
import
multiprocessing
as
mp
...
@@ -68,6 +75,9 @@ class TrainerDesc(object):
...
@@ -68,6 +75,9 @@ class TrainerDesc(object):
from
google.protobuf
import
text_format
from
google.protobuf
import
text_format
return
self
.
proto_desc
.
SerializeToString
()
return
self
.
proto_desc
.
SerializeToString
()
def
__str__
(
self
):
return
str
(
self
.
proto_desc
)
class
MultiTrainer
(
TrainerDesc
):
class
MultiTrainer
(
TrainerDesc
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录