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
6cce6e01
Commit
6cce6e01
authored
Mar 29, 2017
by
JimCai91
Committed by
Yuxin Wu
Mar 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update MinSaver function in saver.py (#212)
* update MinSaver function in saver.py * fix linting and style
parent
a6745419
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
tensorpack/callbacks/saver.py
tensorpack/callbacks/saver.py
+7
-2
No files found.
tensorpack/callbacks/saver.py
View file @
6cce6e01
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
tensorflow
as
tf
import
tensorflow
as
tf
import
os
import
os
import
shutil
import
shutil
import
glob
from
.base
import
Callback
from
.base
import
Callback
from
..utils
import
logger
from
..utils
import
logger
...
@@ -122,10 +123,14 @@ class MinSaver(Callback):
...
@@ -122,10 +123,14 @@ class MinSaver(Callback):
raise
RuntimeError
(
raise
RuntimeError
(
"Cannot find a checkpoint state. Do you forget to use ModelSaver?"
)
"Cannot find a checkpoint state. Do you forget to use ModelSaver?"
)
path
=
ckpt
.
model_checkpoint_path
path
=
ckpt
.
model_checkpoint_path
newname
=
os
.
path
.
join
(
logger
.
LOG_DIR
,
newname
=
os
.
path
.
join
(
logger
.
LOG_DIR
,
self
.
filename
or
self
.
filename
or
(
'max-'
if
self
.
reverse
else
'min-'
+
self
.
monitor_stat
+
'.tfmodel'
))
(
'max-'
if
self
.
reverse
else
'min-'
+
self
.
monitor_stat
))
shutil
.
copy
(
path
,
newname
)
files_to_copy
=
glob
.
glob
(
path
+
'*'
)
for
file_to_copy
in
files_to_copy
:
shutil
.
copy
(
file_to_copy
,
file_to_copy
.
replace
(
path
,
newname
))
#shutil.copy(path, newname)
logger
.
info
(
"Model with {} '{}' saved."
.
format
(
logger
.
info
(
"Model with {} '{}' saved."
.
format
(
'maximum'
if
self
.
reverse
else
'minimum'
,
self
.
monitor_stat
))
'maximum'
if
self
.
reverse
else
'minimum'
,
self
.
monitor_stat
))
...
...
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