Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若苗瞬
DFL_ADRemove
提交
149a2017
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,体验更适合开发者的 AI 搜索 >>
提交
149a2017
编写于
8月 28, 2023
作者:
若苗瞬
😶
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod: delete preview is back.
mod: check model file name, check options before doing anything.
上级
a6aa3874
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
68 addition
and
55 deletion
+68
-55
_internal/model_param/ModelParams.py
_internal/model_param/ModelParams.py
+68
-55
未找到文件。
_internal/model_param/ModelParams.py
浏览文件 @
149a2017
...
...
@@ -15,7 +15,7 @@ if len(sys.argv) < 2:
m
=
{}
for
filename
in
os
.
listdir
(
modelPath
):
# print("["+filename+"]")
if
filename
.
endswith
(
".dat"
):
if
filename
.
endswith
(
"
_options.dat"
)
or
filename
.
endswith
(
"_data
.dat"
):
m
[
str
(
i
)]
=
filename
# print(i," = "+m[i])
i
=
i
+
1
...
...
@@ -54,21 +54,26 @@ MOption = pickle.loads(MContent)
isModified
=
False
key
=
input
(
"Please enter 'Y' to delete loss history and set iteration to 1: "
)
if
key
.
upper
()
==
'Y'
:
print
(
"Clearing loss history."
)
MOption
[
'loss_history'
].
clear
()
print
(
"Resetting iteration to 1."
)
MOption
[
'iter'
]
=
1
isModified
=
True
if
'loss_history'
in
MOption
:
key
=
input
(
"Please enter 'Y' to delete loss history and set iteration to 1: "
)
if
key
.
upper
()
==
'Y'
:
print
(
"Clearing loss history."
)
MOption
[
'loss_history'
].
clear
()
if
'iter'
in
MOption
:
print
(
"Resetting iteration to 1."
)
MOption
[
'iter'
]
=
1
isModified
=
True
# print()
# key = input("Please enter 'Y' to delete sample previews: ")
# if key.upper() == 'Y':
# print("Clearing all previews.")
# MOption['sample_for_preview'].clear()
# isModified = True
if
'sample_for_preview'
in
MOption
:
print
()
key
=
input
(
"Please enter 'Y' to delete sample previews: "
)
if
key
.
upper
()
==
'Y'
:
print
(
"Clearing all previews."
)
MOption
[
'sample_for_preview'
].
clear
()
isModified
=
True
# print()
# print(MOption)
print
()
print
(
"Press any key to next step..."
)
input
()
...
...
@@ -84,53 +89,61 @@ while True:
os
.
system
(
'clear'
)
print
(
"["
+
DFLModelOptionF
+
"]"
)
print
()
print
(
str
(
" model info "
).
center
(
53
,
"*"
))
print
()
print
(
str
(
"iteration"
).
rjust
(
25
),
"="
,
str
(
MOption
[
'iter'
]).
ljust
(
15
))
print
()
print
(
str
(
" model params "
).
center
(
53
,
"*"
))
for
oneOp
in
MOption
[
'options'
]:
print
(
str
(
oneOp
).
rjust
(
25
),
"="
,
str
(
MOption
[
'options'
][
oneOp
]).
ljust
(
15
))
#, type(MOption['options'][oneOp]))
print
()
print
(
str
(
"*******"
).
center
(
53
,
"*"
))
print
()
if
'iter'
in
MOption
:
print
(
str
(
" model info "
).
center
(
53
,
"*"
))
print
()
print
(
str
(
"iteration"
).
rjust
(
25
),
"="
,
str
(
MOption
[
'iter'
]).
ljust
(
15
))
print
()
if
'options'
in
MOption
:
print
(
str
(
" model params "
).
center
(
53
,
"*"
))
for
oneOp
in
MOption
[
'options'
]:
print
(
str
(
oneOp
).
rjust
(
25
),
"="
,
str
(
MOption
[
'options'
][
oneOp
]).
ljust
(
15
))
#, type(MOption['options'][oneOp]))
print
()
print
(
str
(
"*******"
).
center
(
53
,
"*"
))
print
()
key
=
''
print
(
"Input a existing param name to modify. or a new param name to add. Input 'quit' to save quit."
)
print
(
"then input param value, if ' ' means to delete."
)
print
()
key
=
input
(
"Please input param name: "
)
if
key
==
'quit'
or
key
==
'
\26
'
:
break
elif
key
.
strip
()
==
''
:
continue
else
:
content
=
input
(
"Please input param value: "
)
key
=
''
print
(
"Input a existing param name to modify. or a new param name to add. Input 'quit' to save quit."
)
print
(
"then input param value, if ' ' means to delete."
)
print
()
if
content
==
' '
:
del
MOption
[
'options'
][
key
]
isModified
=
True
else
:
try
:
intcontent
=
int
(
content
)
MOption
[
'options'
][
key
]
=
intcontent
print
(
key
+
" is set to INTEGER value ="
,
intcontent
)
except
:
key
=
input
(
"Please input param name: "
)
if
key
==
'quit'
or
key
==
'
\26
'
:
break
elif
key
.
strip
()
==
''
:
continue
else
:
content
=
input
(
"Please input param value: "
)
print
()
if
content
==
' '
:
del
MOption
[
'options'
][
key
]
isModified
=
True
else
:
try
:
fcontent
=
floa
t
(
content
)
MOption
[
'options'
][
key
]
=
f
content
print
(
key
+
" is set to
FLOAT value ="
,
f
content
)
intcontent
=
in
t
(
content
)
MOption
[
'options'
][
key
]
=
int
content
print
(
key
+
" is set to
INTEGER value ="
,
int
content
)
except
:
try
:
bcontent
=
bool
(
strtobool
(
content
)
)
MOption
[
'options'
][
key
]
=
b
content
print
(
key
+
" is set to
BOOL value ="
,
b
content
)
fcontent
=
float
(
content
)
MOption
[
'options'
][
key
]
=
f
content
print
(
key
+
" is set to
FLOAT value ="
,
f
content
)
except
:
MOption
[
'options'
][
key
]
=
content
print
(
key
+
" is set to STRING value ="
,
content
)
print
(
"Press any key to choose param..."
)
input
()
isModified
=
True
try
:
bcontent
=
bool
(
strtobool
(
content
))
MOption
[
'options'
][
key
]
=
bcontent
print
(
key
+
" is set to BOOL value ="
,
bcontent
)
except
:
MOption
[
'options'
][
key
]
=
content
print
(
key
+
" is set to STRING value ="
,
content
)
print
(
"Press any key to choose param..."
)
input
()
isModified
=
True
else
:
print
(
"No option found in file..."
)
print
()
print
(
MOption
)
print
()
break
if
isModified
:
print
(
"now saving..."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录