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
c24697ee
You need to sign in or sign up before continuing.
Commit
c24697ee
authored
May 03, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try resume training..
parent
e5f9f83a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
tensorpack/tfutils/sessinit.py
tensorpack/tfutils/sessinit.py
+16
-1
No files found.
tensorpack/tfutils/sessinit.py
View file @
c24697ee
...
...
@@ -15,7 +15,7 @@ from .varmanip import (SessionUpdate, get_savename_from_varname,
__all__
=
[
'SessionInit'
,
'SaverRestore'
,
'SaverRestoreRelaxed'
,
'ParamRestore'
,
'DictRestore'
,
'ChainInit'
,
'JustCurrentSession'
,
'get_model_loader'
]
'JustCurrentSession'
,
'get_model_loader'
,
'TryResumeTraining'
]
class
SessionInit
(
object
):
...
...
@@ -235,3 +235,18 @@ def get_model_loader(filename):
return
DictRestore
(
np
.
load
(
filename
,
encoding
=
'latin1'
)
.
item
())
else
:
return
SaverRestore
(
filename
)
def
TryResumeTraining
():
"""
Load latest checkpoint from LOG_DIR, if there is one.
Returns:
SessInit: either a :class:`JustCurrentSession`, or a :class:`SaverRestore`.
"""
if
not
logger
.
LOG_DIR
:
return
JustCurrentSession
()
path
=
os
.
path
.
join
(
logger
.
LOG_DIR
,
'checkpoint'
)
if
not
os
.
path
.
isfile
(
path
):
return
JustCurrentSession
()
return
SaverRestore
(
path
)
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