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
67786cbb
You need to sign in or sign up before continuing.
Commit
67786cbb
authored
Jul 08, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
latest model link
parent
771a8b0f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
tensorpack/callbacks/common.py
tensorpack/callbacks/common.py
+11
-1
tensorpack/callbacks/summary.py
tensorpack/callbacks/summary.py
+6
-1
tensorpack/train/base.py
tensorpack/train/base.py
+3
-0
No files found.
tensorpack/callbacks/common.py
View file @
67786cbb
...
...
@@ -61,7 +61,17 @@ class ModelSaver(Callback):
self
.
path
,
global_step
=
self
.
global_step
,
write_meta_graph
=
False
)
except
Exception
:
# disk error sometimes..
# create a symbolic link for the latest model
latest
=
self
.
saver
.
last_checkpoints
[
-
1
]
basename
=
os
.
path
.
basename
(
latest
)
linkname
=
os
.
path
.
join
(
os
.
path
.
dirname
(
latest
),
'latest'
)
try
:
os
.
unlink
(
linkname
)
except
FileNotFoundError
:
pass
os
.
symlink
(
basename
,
linkname
)
except
Exception
:
# disk error sometimes.. just ignore
logger
.
exception
(
"Exception in ModelSaver.trigger_epoch!"
)
class
MinSaver
(
Callback
):
...
...
tensorpack/callbacks/summary.py
View file @
67786cbb
...
...
@@ -22,6 +22,7 @@ class StatHolder(object):
:param log_dir: directory to save the stats.
"""
self
.
set_print_tag
([])
self
.
blacklist_tag
=
set
()
self
.
stat_now
=
{}
self
.
log_dir
=
log_dir
...
...
@@ -47,6 +48,9 @@ class StatHolder(object):
"""
self
.
print_tag
=
None
if
print_tag
is
None
else
set
(
print_tag
)
def
add_blacklist_tag
(
self
,
blacklist_tag
):
self
.
blacklist_tag
|=
set
(
blacklist_tag
)
def
get_stat_now
(
self
,
key
):
"""
Return the value of a stat in the current epoch.
...
...
@@ -65,6 +69,7 @@ class StatHolder(object):
def
_print_stat
(
self
):
for
k
,
v
in
sorted
(
self
.
stat_now
.
items
(),
key
=
operator
.
itemgetter
(
0
)):
if
self
.
print_tag
is
None
or
k
in
self
.
print_tag
:
if
k
not
in
self
.
blacklist_tag
:
logger
.
info
(
'{}: {:.5g}'
.
format
(
k
,
v
))
def
_write_stat
(
self
):
...
...
tensorpack/train/base.py
View file @
67786cbb
...
...
@@ -68,6 +68,7 @@ class Trainer(object):
self
.
_trigger_epoch
()
self
.
config
.
callbacks
.
trigger_epoch
()
self
.
summary_writer
.
flush
()
self
.
stat_holder
.
add_stat
(
'global_step'
,
self
.
global_step
)
self
.
stat_holder
.
finalize
()
@
abstractmethod
...
...
@@ -83,6 +84,8 @@ class Trainer(object):
self
.
summary_op
=
tf
.
merge_all_summaries
()
# create an empty StatHolder
self
.
stat_holder
=
StatHolder
(
logger
.
LOG_DIR
)
# save global_step in stat.json, but don't print it
self
.
stat_holder
.
add_blacklist_tag
([
'global_step'
])
def
_process_summary
(
self
,
summary_str
):
summary
=
tf
.
Summary
.
FromString
(
summary_str
)
...
...
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