Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
3c915be5
P
PaddleRec
项目概览
BaiXuePrincess
/
PaddleRec
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleRec
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3c915be5
编写于
5月 18, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
windows path adapt
上级
72e086b5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
6 deletion
+13
-6
core/utils/envs.py
core/utils/envs.py
+10
-3
run.py
run.py
+3
-3
未找到文件。
core/utils/envs.py
浏览文件 @
3c915be5
...
@@ -89,7 +89,7 @@ def get_global_envs():
...
@@ -89,7 +89,7 @@ def get_global_envs():
return
global_envs
return
global_envs
def
windows_
path_adapter
(
path
):
def
path_adapter
(
path
):
def
adapt
(
l_p
):
def
adapt
(
l_p
):
if
get_platform
()
==
"WINDOWS"
:
if
get_platform
()
==
"WINDOWS"
:
adapted_p
=
l_p
.
split
(
"paddlerec."
)[
1
].
replace
(
"."
,
"
\\
"
)
adapted_p
=
l_p
.
split
(
"paddlerec."
)[
1
].
replace
(
"."
,
"
\\
"
)
...
@@ -104,16 +104,23 @@ def windows_path_adapter(path):
...
@@ -104,16 +104,23 @@ def windows_path_adapter(path):
return
adapt
(
path
)
return
adapt
(
path
)
def
windows_path_converter
(
path
):
if
get_platform
()
==
"WINDOWS"
:
return
path
.
replace
(
"/"
,
"
\\
"
)
else
:
return
path
.
replace
(
"
\\
"
,
"/"
)
def
update_workspace
():
def
update_workspace
():
workspace
=
global_envs
.
get
(
"train.workspace"
,
None
)
workspace
=
global_envs
.
get
(
"train.workspace"
,
None
)
if
not
workspace
:
if
not
workspace
:
return
return
workspace
=
windows_
path_adapter
(
workspace
)
workspace
=
path_adapter
(
workspace
)
for
name
,
value
in
global_envs
.
items
():
for
name
,
value
in
global_envs
.
items
():
if
isinstance
(
value
,
str
):
if
isinstance
(
value
,
str
):
value
=
value
.
replace
(
"{workspace}"
,
workspace
)
value
=
value
.
replace
(
"{workspace}"
,
workspace
)
value
=
windows_path_
adap
ter
(
value
)
value
=
windows_path_
conver
ter
(
value
)
global_envs
[
name
]
=
value
global_envs
[
name
]
=
value
...
...
run.py
浏览文件 @
3c915be5
...
@@ -132,11 +132,11 @@ def cluster_engine(args):
...
@@ -132,11 +132,11 @@ def cluster_engine(args):
if
not
workspace
:
if
not
workspace
:
return
return
path
=
envs
.
windows_
path_adapter
(
workspace
)
path
=
envs
.
path_adapter
(
workspace
)
for
name
,
value
in
cluster_envs
.
items
():
for
name
,
value
in
cluster_envs
.
items
():
if
isinstance
(
value
,
str
):
if
isinstance
(
value
,
str
):
value
=
value
.
replace
(
"{workspace}"
,
path
)
value
=
value
.
replace
(
"{workspace}"
,
path
)
value
=
envs
.
windows_path_
adap
ter
(
value
)
value
=
envs
.
windows_path_
conver
ter
(
value
)
cluster_envs
[
name
]
=
value
cluster_envs
[
name
]
=
value
def
master
():
def
master
():
...
@@ -240,7 +240,7 @@ def local_mpi_engine(args):
...
@@ -240,7 +240,7 @@ def local_mpi_engine(args):
def
get_abs_model
(
model
):
def
get_abs_model
(
model
):
if
model
.
startswith
(
"paddlerec."
):
if
model
.
startswith
(
"paddlerec."
):
dir
=
envs
.
windows_
path_adapter
(
model
)
dir
=
envs
.
path_adapter
(
model
)
path
=
os
.
path
.
join
(
dir
,
"config.yaml"
)
path
=
os
.
path
.
join
(
dir
,
"config.yaml"
)
else
:
else
:
if
not
os
.
path
.
isfile
(
model
):
if
not
os
.
path
.
isfile
(
model
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录