Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
789f082f
Commit
789f082f
authored
May 21, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs about HumanHyperParamSetter; add 'q' action to avoid getting stuck
parent
900a7eb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
tensorpack/callbacks/param.py
tensorpack/callbacks/param.py
+5
-6
tensorpack/utils/logger.py
tensorpack/utils/logger.py
+5
-3
No files found.
tensorpack/callbacks/param.py
View file @
789f082f
...
@@ -52,7 +52,7 @@ class HyperParam(object):
...
@@ -52,7 +52,7 @@ class HyperParam(object):
class
GraphVarParam
(
HyperParam
):
class
GraphVarParam
(
HyperParam
):
""" A variable in the graph (e.g. learning_rate) can be a hyperparam"""
""" A variable in the graph (e.g. learning_rate) can be a hyperparam
.
"""
def
__init__
(
self
,
name
,
shape
=
[]):
def
__init__
(
self
,
name
,
shape
=
[]):
"""
"""
...
@@ -91,7 +91,7 @@ class ObjAttrParam(HyperParam):
...
@@ -91,7 +91,7 @@ class ObjAttrParam(HyperParam):
Args:
Args:
obj: the object
obj: the object
attrname (str): the attribute
attrname (str): the attribute
readable_name(str): The name to display. Defaults to be ``attrname``.
readable_name(str): The name to display
and set with
. Defaults to be ``attrname``.
"""
"""
self
.
obj
=
obj
self
.
obj
=
obj
self
.
attrname
=
attrname
self
.
attrname
=
attrname
...
@@ -179,10 +179,9 @@ class HumanHyperParamSetter(HyperParamSetter):
...
@@ -179,10 +179,9 @@ class HumanHyperParamSetter(HyperParamSetter):
"""
"""
Args:
Args:
param: same as in :class:`HyperParamSetter`.
param: same as in :class:`HyperParamSetter`.
file_name(str): a file containing the value of the variable.
file_name(str): a file containing the new value of the parameter.
Each line in the file is a k:v pair, where k is
Each line in the file is a ``k:v`` pair, for example, ``learning_rate:1e-4``.
param.readable_name, and v is the value. If the pair is not found,
If the pair is not found, the param will not be changed.
the param will not be changed.
"""
"""
super
(
HumanHyperParamSetter
,
self
)
.
__init__
(
param
)
super
(
HumanHyperParamSetter
,
self
)
.
__init__
(
param
)
self
.
file_name
=
os
.
path
.
join
(
logger
.
LOG_DIR
,
file_name
)
self
.
file_name
=
os
.
path
.
join
(
logger
.
LOG_DIR
,
file_name
)
...
...
tensorpack/utils/logger.py
View file @
789f082f
...
@@ -79,7 +79,7 @@ def set_logger_dir(dirname, action=None):
...
@@ -79,7 +79,7 @@ def set_logger_dir(dirname, action=None):
Args:
Args:
dirname(str): log directory
dirname(str): log directory
action(str): an action of ("k","b","d","n") to be performed. Will ask user by default.
action(str): an action of ("k","b","d","n"
,"q"
) to be performed. Will ask user by default.
"""
"""
global
LOG_DIR
,
_FILE_HANDLER
global
LOG_DIR
,
_FILE_HANDLER
if
_FILE_HANDLER
:
if
_FILE_HANDLER
:
...
@@ -89,10 +89,10 @@ def set_logger_dir(dirname, action=None):
...
@@ -89,10 +89,10 @@ def set_logger_dir(dirname, action=None):
if
os
.
path
.
isdir
(
dirname
):
if
os
.
path
.
isdir
(
dirname
):
if
not
action
:
if
not
action
:
_logger
.
warn
(
"""
\
_logger
.
warn
(
"""
\
D
irectory {} exists! Please either backup/delete it, or use a new directory."""
.
format
(
dirname
))
Log d
irectory {} exists! Please either backup/delete it, or use a new directory."""
.
format
(
dirname
))
_logger
.
warn
(
"""
\
_logger
.
warn
(
"""
\
If you're resuming from a previous run you can choose to keep it."""
)
If you're resuming from a previous run you can choose to keep it."""
)
_logger
.
info
(
"Select Action: k (keep) / b (backup) / d (delete) / n (new):"
)
_logger
.
info
(
"Select Action: k (keep) / b (backup) / d (delete) / n (new)
/ q (quit)
:"
)
while
not
action
:
while
not
action
:
action
=
input
()
.
lower
()
.
strip
()
action
=
input
()
.
lower
()
.
strip
()
act
=
action
act
=
action
...
@@ -107,6 +107,8 @@ If you're resuming from a previous run you can choose to keep it.""")
...
@@ -107,6 +107,8 @@ If you're resuming from a previous run you can choose to keep it.""")
info
(
"Use a new log directory {}"
.
format
(
dirname
))
# noqa: F821
info
(
"Use a new log directory {}"
.
format
(
dirname
))
# noqa: F821
elif
act
==
'k'
:
elif
act
==
'k'
:
pass
pass
elif
act
==
'q'
:
sys
.
exit
()
else
:
else
:
raise
ValueError
(
"Unknown action: {}"
.
format
(
act
))
raise
ValueError
(
"Unknown action: {}"
.
format
(
act
))
LOG_DIR
=
dirname
LOG_DIR
=
dirname
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment