Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若苗瞬
DFL_ADRemove
提交
d4d764d3
D
DFL_ADRemove
项目概览
若苗瞬
/
DFL_ADRemove
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DFL_ADRemove
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d4d764d3
编写于
9月 11, 2023
作者:
若苗瞬
😶
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod: don't panic when file is a merge option
上级
dde86185
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
4 deletion
+16
-4
_internal/model_param/ModelParams.py
_internal/model_param/ModelParams.py
+16
-4
未找到文件。
_internal/model_param/ModelParams.py
浏览文件 @
d4d764d3
...
@@ -11,6 +11,10 @@ wsPath = os.environ.get("WORKSPACE")
...
@@ -11,6 +11,10 @@ wsPath = os.environ.get("WORKSPACE")
if
wsPath
!=
""
:
if
wsPath
!=
""
:
modelPath
=
wsPath
+
"
\\
model
\\
"
modelPath
=
wsPath
+
"
\\
model
\\
"
dflPath
=
os
.
environ
.
get
(
"DFL_ROOT"
)
if
dflPath
!=
""
:
sys
.
path
.
append
(
dflPath
)
DFLModelOptionF
=
""
DFLModelOptionF
=
""
if
len
(
sys
.
argv
)
<
2
:
if
len
(
sys
.
argv
)
<
2
:
# print("Error! need a model file name!")
# print("Error! need a model file name!")
...
@@ -19,13 +23,14 @@ if len(sys.argv) < 2:
...
@@ -19,13 +23,14 @@ if len(sys.argv) < 2:
m
=
{}
m
=
{}
for
filename
in
os
.
listdir
(
modelPath
):
for
filename
in
os
.
listdir
(
modelPath
):
# print("["+filename+"]")
# print("["+filename+"]")
if
filename
.
endswith
(
"
_options.dat"
)
or
filename
.
endswith
(
"_data
.dat"
):
if
filename
.
endswith
(
".dat"
):
m
[
str
(
i
)]
=
filename
m
[
str
(
i
)]
=
filename
# print(i," = "+m[i])
# print(i," = "+m[i])
i
=
i
+
1
i
=
i
+
1
if
len
(
m
)
==
0
:
if
len
(
m
)
==
0
:
print
(
"no model option file found, quit."
)
print
(
"no model option file found, quit."
)
print
()
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
print
(
"!!! Please backup your model first !!!"
)
print
(
"!!! Please backup your model first !!!"
)
...
@@ -42,6 +47,7 @@ if len(sys.argv) < 2:
...
@@ -42,6 +47,7 @@ if len(sys.argv) < 2:
print
()
print
()
if
not
key
in
m
:
if
not
key
in
m
:
print
(
"not a choice, quit."
)
print
(
"not a choice, quit."
)
print
()
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
DFLModelOptionF
=
os
.
path
.
abspath
(
modelPath
+
m
[
key
])
DFLModelOptionF
=
os
.
path
.
abspath
(
modelPath
+
m
[
key
])
...
@@ -50,7 +56,8 @@ else:
...
@@ -50,7 +56,8 @@ else:
DFLModelOptionF
=
os
.
path
.
abspath
(
modelPath
+
sys
.
argv
[
1
])
DFLModelOptionF
=
os
.
path
.
abspath
(
modelPath
+
sys
.
argv
[
1
])
if
not
Path
(
DFLModelOptionF
).
exists
:
if
not
Path
(
DFLModelOptionF
).
exists
:
print
(
"Error! model file is not found!"
)
print
(
"Error! model option file is not found!"
)
print
()
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
MContent
=
Path
(
DFLModelOptionF
).
read_bytes
()
MContent
=
Path
(
DFLModelOptionF
).
read_bytes
()
...
@@ -58,6 +65,11 @@ MOption = pickle.loads(MContent)
...
@@ -58,6 +65,11 @@ MOption = pickle.loads(MContent)
isModified
=
False
isModified
=
False
if
(
'frames'
in
MOption
)
and
(
'frames'
in
MOption
)
and
(
'frames'
in
MOption
):
print
(
"Error! this is merge option file!"
)
print
()
sys
.
exit
(
-
1
)
if
'loss_history'
in
MOption
:
if
'loss_history'
in
MOption
:
key
=
input
(
"Please enter 'Y' to delete loss history and set iteration to 1: "
)
key
=
input
(
"Please enter 'Y' to delete loss history and set iteration to 1: "
)
if
key
.
upper
()
==
'Y'
:
if
key
.
upper
()
==
'Y'
:
...
@@ -76,8 +88,8 @@ if 'sample_for_preview' in MOption:
...
@@ -76,8 +88,8 @@ if 'sample_for_preview' in MOption:
MOption
[
'sample_for_preview'
].
clear
()
MOption
[
'sample_for_preview'
].
clear
()
isModified
=
True
isModified
=
True
#
print()
print
()
#
print(MOption)
print
(
MOption
)
print
()
print
()
print
(
"Press any key to next step..."
)
print
(
"Press any key to next step..."
)
input
()
input
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录