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
01f54c26
Commit
01f54c26
authored
Feb 26, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs update
parent
000b2ea3
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
82 additions
and
29 deletions
+82
-29
docs/modules/RL.rst
docs/modules/RL.rst
+0
-0
docs/modules/callbacks.rst
docs/modules/callbacks.rst
+0
-0
docs/modules/dataflow.dataset.rst
docs/modules/dataflow.dataset.rst
+0
-0
docs/modules/dataflow.imgaug.rst
docs/modules/dataflow.imgaug.rst
+0
-0
docs/modules/dataflow.rst
docs/modules/dataflow.rst
+8
-8
docs/modules/index.rst
docs/modules/index.rst
+8
-8
docs/modules/models.rst
docs/modules/models.rst
+0
-0
docs/modules/predict.rst
docs/modules/predict.rst
+0
-0
docs/modules/tfutils.rst
docs/modules/tfutils.rst
+0
-0
docs/modules/train.rst
docs/modules/train.rst
+15
-0
docs/modules/utils.rst
docs/modules/utils.rst
+0
-0
docs/tutorial/callback.md
docs/tutorial/callback.md
+0
-2
tensorpack/train/__init__.py
tensorpack/train/__init__.py
+4
-2
tensorpack/train/monitor.py
tensorpack/train/monitor.py
+47
-9
No files found.
docs/modules/
tensorpack.
RL.rst
→
docs/modules/RL.rst
View file @
01f54c26
File moved
docs/modules/
tensorpack.
callbacks.rst
→
docs/modules/callbacks.rst
View file @
01f54c26
File moved
docs/modules/
tensorpack.
dataflow.dataset.rst
→
docs/modules/dataflow.dataset.rst
View file @
01f54c26
File moved
docs/modules/
tensorpack.
dataflow.imgaug.rst
→
docs/modules/dataflow.imgaug.rst
View file @
01f54c26
File moved
docs/modules/
tensorpack.
dataflow.rst
→
docs/modules/dataflow.rst
View file @
01f54c26
...
...
@@ -6,21 +6,21 @@ Subpackages
.. toctree::
tensorpack.
dataflow.dataset
tensorpack.
dataflow.imgaug
dataflow.dataset
dataflow.imgaug
tensorpack.dataflow.dftools module
---------------
-------------------
Module contents
---------------
.. automodule:: tensorpack.dataflow
.dftools
.. automodule:: tensorpack.dataflow
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
tensorpack.dataflow.dftools module
---------------
-------------------
.. automodule:: tensorpack.dataflow
.. automodule:: tensorpack.dataflow
.dftools
:members:
:undoc-members:
:show-inheritance:
docs/modules/index.rst
View file @
01f54c26
...
...
@@ -5,12 +5,12 @@ API Documentation
:maxdepth: 1
tensorpack.
models
tensorpack.
dataflow
tensorpack.
callbacks
t
ensorpack.t
rain
tensorpack.utils
t
ensorpack.t
futils
tensorpack.predict
tensorpack.
RL
models
dataflow
callbacks
train
predict
tfutils
utils
RL
docs/modules/
tensorpack.
models.rst
→
docs/modules/models.rst
View file @
01f54c26
File moved
docs/modules/
tensorpack.
predict.rst
→
docs/modules/predict.rst
View file @
01f54c26
File moved
docs/modules/t
ensorpack.t
futils.rst
→
docs/modules/tfutils.rst
View file @
01f54c26
File moved
docs/modules/t
ensorpack.t
rain.rst
→
docs/modules/train.rst
View file @
01f54c26
...
...
@@ -5,3 +5,11 @@ tensorpack.train package
:members:
:undoc-members:
:show-inheritance:
tensorpack.train.monitor module
------------------------------------
.. automodule:: tensorpack.train.monitor
:members:
:undoc-members:
:show-inheritance:
docs/modules/
tensorpack.
utils.rst
→
docs/modules/utils.rst
View file @
01f54c26
File moved
docs/tutorial/callback.md
View file @
01f54c26
...
...
@@ -46,8 +46,6 @@ TrainConfig(
ProgressBar
(),
# run `tf.summary.merge_all` and save results every epoch
MergeAllSummaries
(),
# print all the statistics I've created, and scalar tensors I've summarized
StatPrinter
(),
]
)
```
...
...
tensorpack/train/__init__.py
View file @
01f54c26
...
...
@@ -6,7 +6,7 @@ from pkgutil import iter_modules
import
os
import
os.path
__all__
=
[]
__all__
=
[
'monitor'
]
def
global_import
(
name
):
...
...
@@ -19,6 +19,7 @@ def global_import(name):
_CURR_DIR
=
os
.
path
.
dirname
(
__file__
)
_SKIP
=
[
'monitor'
]
for
_
,
module_name
,
_
in
iter_modules
(
[
_CURR_DIR
]):
srcpath
=
os
.
path
.
join
(
_CURR_DIR
,
module_name
+
'.py'
)
...
...
@@ -26,4 +27,5 @@ for _, module_name, _ in iter_modules(
continue
if
module_name
.
startswith
(
'_'
):
continue
global_import
(
module_name
)
if
module_name
not
in
_SKIP
:
global_import
(
module_name
)
tensorpack/train/monitor.py
View file @
01f54c26
...
...
@@ -21,20 +21,35 @@ class TrainingMonitor(object):
"""
Monitor a training progress, by processing different types of
summary/statistics from trainer.
.. document private functions
.. automethod:: _setup
"""
def
setup
(
self
,
trainer
):
self
.
_trainer
=
trainer
self
.
_setup
()
def
_setup
(
self
):
""" Override this method to setup the monitor."""
pass
def
put_summary
(
self
,
summary
):
"""
Process a tf.Summary.
"""
pass
def
put
(
self
,
name
,
val
):
# TODO split by types?
def
put
(
self
,
name
,
val
):
"""
Process a key-value pair.
"""
pass
def
put_scalar
(
self
,
name
,
val
):
self
.
put
(
name
,
val
)
# TODO put other types
def
flush
(
self
):
pass
...
...
@@ -47,6 +62,9 @@ class NoOpMonitor(TrainingMonitor):
class
Monitors
(
TrainingMonitor
):
"""
Merge monitors together for trainer to use.
"""
def
__init__
(
self
,
monitors
):
# TODO filter by names
self
.
_scalar_history
=
ScalarHistory
()
...
...
@@ -68,9 +86,9 @@ class Monitors(TrainingMonitor):
for
m
in
self
.
_monitors
:
m
.
put_summary
(
summary
)
def
_dispatch_put
(
self
,
name
,
val
):
def
_dispatch_put
_scalar
(
self
,
name
,
val
):
for
m
in
self
.
_monitors
:
m
.
put
(
name
,
val
)
m
.
put
_scalar
(
name
,
val
)
def
put_summary
(
self
,
summary
):
if
isinstance
(
summary
,
six
.
binary_type
):
...
...
@@ -86,24 +104,35 @@ class Monitors(TrainingMonitor):
suffix
=
'-summary'
# issue#6150
if
val
.
tag
.
endswith
(
suffix
):
val
.
tag
=
val
.
tag
[:
-
len
(
suffix
)]
self
.
_dispatch_put
(
val
.
tag
,
val
.
simple_value
)
self
.
_dispatch_put
_scalar
(
val
.
tag
,
val
.
simple_value
)
def
put
(
self
,
name
,
val
):
val
=
float
(
val
)
# TODO only support numeric for now
val
=
float
(
val
)
# TODO only support scalar for now
self
.
put_scalar
(
name
,
val
)
self
.
_dispatch_put
(
name
,
val
)
def
put_scalar
(
self
,
name
,
val
):
self
.
_dispatch_put_scalar
(
name
,
val
)
s
=
tf
.
Summary
()
s
.
value
.
add
(
tag
=
name
,
simple_value
=
val
)
self
.
_dispatch_put_summary
(
s
)
def
get_latest
(
self
,
name
):
"""
Get latest scalar value of some data.
"""
return
self
.
_scalar_history
.
get_latest
(
name
)
def
get_history
(
self
,
name
):
"""
Get a history of the scalar value of some data.
"""
return
self
.
_scalar_history
.
get_history
(
name
)
class
TFSummaryWriter
(
TrainingMonitor
):
"""
Write summaries to TensorFlow event file.
"""
def
__new__
(
cls
):
if
logger
.
LOG_DIR
:
return
super
(
TFSummaryWriter
,
cls
)
.
__new__
(
cls
)
...
...
@@ -126,6 +155,9 @@ class TFSummaryWriter(TrainingMonitor):
class
JSONWriter
(
TrainingMonitor
):
"""
Write all scalar data to a json, grouped by their global step.
"""
def
__new__
(
cls
):
if
logger
.
LOG_DIR
:
return
super
(
JSONWriter
,
cls
)
.
__new__
(
cls
)
...
...
@@ -150,7 +182,7 @@ class JSONWriter(TrainingMonitor):
self
.
_last_gs
=
-
1
def
put
(
self
,
name
,
val
):
def
put
_scalar
(
self
,
name
,
val
):
gs
=
self
.
_trainer
.
global_step
if
gs
!=
self
.
_last_gs
:
self
.
_push
()
...
...
@@ -181,6 +213,9 @@ class JSONWriter(TrainingMonitor):
# TODO print interval
class
ScalarPrinter
(
TrainingMonitor
):
"""
Print all scalar data in terminal.
"""
def
__init__
(
self
):
self
.
_whitelist
=
None
self
.
_blacklist
=
set
([])
...
...
@@ -188,7 +223,7 @@ class ScalarPrinter(TrainingMonitor):
def
setup
(
self
,
_
):
self
.
_dic
=
{}
def
put
(
self
,
name
,
val
):
def
put
_scalar
(
self
,
name
,
val
):
self
.
_dic
[
name
]
=
float
(
val
)
def
_print_stat
(
self
):
...
...
@@ -203,10 +238,13 @@ class ScalarPrinter(TrainingMonitor):
class
ScalarHistory
(
TrainingMonitor
):
"""
Only used by monitors internally.
"""
def
setup
(
self
,
_
):
self
.
_dic
=
defaultdict
(
list
)
def
put
(
self
,
name
,
val
):
def
put
_scalar
(
self
,
name
,
val
):
self
.
_dic
[
name
]
.
append
(
float
(
val
))
def
get_latest
(
self
,
name
):
...
...
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