Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
fe6fc5b3
P
PaddleRec
项目概览
PaddlePaddle
/
PaddleRec
通知
68
Star
12
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
27
列表
看板
标记
里程碑
合并请求
10
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
27
Issue
27
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe6fc5b3
编写于
6月 10, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix windows adapter
上级
c6a3a9fd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
24 deletion
+21
-24
core/trainers/framework/network.py
core/trainers/framework/network.py
+8
-4
core/utils/envs.py
core/utils/envs.py
+13
-20
未找到文件。
core/trainers/framework/network.py
浏览文件 @
fe6fc5b3
...
...
@@ -58,7 +58,8 @@ class SingleNetwork(NetworkBase):
with
fluid
.
program_guard
(
train_program
,
startup_program
):
with
fluid
.
unique_name
.
guard
():
with
fluid
.
scope_guard
(
scope
):
model_path
=
model_dict
[
"model"
]
model_path
=
envs
.
os_path_adapter
(
envs
.
workspace_adapter
(
model_dict
[
"model"
]))
model
=
envs
.
lazy_instance_by_fliename
(
model_path
,
"Model"
)(
None
)
...
...
@@ -121,7 +122,8 @@ class PSNetwork(NetworkBase):
context
[
"model"
][
model_dict
[
"name"
]]
=
{}
dataset_name
=
model_dict
[
"dataset_name"
]
model_path
=
model_dict
[
"model"
]
model_path
=
envs
.
os_path_adapter
(
envs
.
workspace_adapter
(
model_dict
[
"model"
]))
model
=
envs
.
lazy_instance_by_fliename
(
model_path
,
"Model"
)(
None
)
model
.
_data_var
=
model
.
input_data
(
dataset_name
=
model_dict
[
"dataset_name"
])
...
...
@@ -212,7 +214,8 @@ class PslibNetwork(NetworkBase):
with
fluid
.
unique_name
.
guard
():
with
fluid
.
scope_guard
(
scope
):
context
[
"model"
][
model_dict
[
"name"
]]
=
{}
model_path
=
model_dict
[
"model"
]
model_path
=
envs
.
os_path_adapter
(
envs
.
workspace_adapter
(
model_dict
[
"model"
]))
model
=
envs
.
lazy_instance_by_fliename
(
model_path
,
"Model"
)(
None
)
model
.
_data_var
=
model
.
input_data
(
...
...
@@ -277,7 +280,8 @@ class CollectiveNetwork(NetworkBase):
scope
=
fluid
.
Scope
()
with
fluid
.
program_guard
(
train_program
,
startup_program
):
with
fluid
.
scope_guard
(
scope
):
model_path
=
model_dict
[
"model"
]
model_path
=
envs
.
os_path_adapter
(
envs
.
workspace_adapter
(
model_dict
[
"model"
]))
model
=
envs
.
lazy_instance_by_fliename
(
model_path
,
"Model"
)(
None
)
model
.
_data_var
=
model
.
input_data
(
...
...
core/utils/envs.py
浏览文件 @
fe6fc5b3
...
...
@@ -91,9 +91,10 @@ def set_global_envs(envs):
fatten_env_namespace
([],
envs
)
workspace_adapter
()
os_path_adapter
()
reader_adapter
()
for
name
,
value
in
global_envs
.
items
():
if
isinstance
(
value
,
str
):
value
=
os_path_adapter
(
workspace_adapter
(
value
))
global_envs
[
name
]
=
value
def
get_global_env
(
env_name
,
default_value
=
None
,
namespace
=
None
):
...
...
@@ -118,27 +119,19 @@ def paddlerec_adapter(path):
return
path
def
os_path_adapter
():
for
name
,
value
in
global_envs
.
items
():
if
isinstance
(
value
,
str
):
if
get_platform
()
==
"WINDOWS"
:
value
=
value
.
replace
(
"/"
,
"
\\
"
)
else
:
value
=
value
.
replace
(
"
\\
"
,
"/"
)
global_envs
[
name
]
=
value
def
os_path_adapter
(
value
):
if
get_platform
()
==
"WINDOWS"
:
value
=
value
.
replace
(
"/"
,
"
\\
"
)
else
:
value
=
value
.
replace
(
"
\\
"
,
"/"
)
return
value
def
workspace_adapter
():
def
workspace_adapter
(
value
):
workspace
=
global_envs
.
get
(
"workspace"
)
if
not
workspace
:
return
workspace
=
paddlerec_adapter
(
workspace
)
for
name
,
value
in
global_envs
.
items
():
if
isinstance
(
value
,
str
):
value
=
value
.
replace
(
"{workspace}"
,
workspace
)
global_envs
[
name
]
=
value
value
=
value
.
replace
(
"{workspace}"
,
workspace
)
return
value
def
reader_adapter
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录