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
193f6056
Commit
193f6056
authored
Sep 04, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs; bump version
parent
65c0b326
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
41 additions
and
14 deletions
+41
-14
.github/ISSUE_TEMPLATE/unexpected-problems---bugs.md
.github/ISSUE_TEMPLATE/unexpected-problems---bugs.md
+1
-1
.github/ISSUE_TEMPLATE/using-understanding-tensorpack.md
.github/ISSUE_TEMPLATE/using-understanding-tensorpack.md
+3
-0
docs/modules/callbacks.rst
docs/modules/callbacks.rst
+1
-1
docs/modules/utils.rst
docs/modules/utils.rst
+1
-1
docs/tutorial/extend/callback.md
docs/tutorial/extend/callback.md
+5
-0
examples/FasterRCNN/config.py
examples/FasterRCNN/config.py
+9
-0
tensorpack/callbacks/inference.py
tensorpack/callbacks/inference.py
+1
-1
tensorpack/callbacks/misc.py
tensorpack/callbacks/misc.py
+1
-1
tensorpack/callbacks/monitor.py
tensorpack/callbacks/monitor.py
+7
-0
tensorpack/callbacks/summary.py
tensorpack/callbacks/summary.py
+0
-3
tensorpack/input_source/input_source.py
tensorpack/input_source/input_source.py
+3
-1
tensorpack/libinfo.py
tensorpack/libinfo.py
+1
-1
tensorpack/models/tflayer.py
tensorpack/models/tflayer.py
+2
-0
tensorpack/tfutils/sesscreate.py
tensorpack/tfutils/sesscreate.py
+1
-1
tensorpack/utils/concurrency.py
tensorpack/utils/concurrency.py
+3
-3
tensorpack/utils/develop.py
tensorpack/utils/develop.py
+2
-0
No files found.
.github/ISSUE_TEMPLATE/unexpected-problems---bugs.md
View file @
193f6056
...
@@ -20,6 +20,6 @@ __PLEASE ALWAYS INCLUDE__:
...
@@ -20,6 +20,6 @@ __PLEASE ALWAYS INCLUDE__:
+
TF version:
`python -c 'import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)'`
.
+
TF version:
`python -c 'import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)'`
.
+
Tensorpack version:
`python -c 'import tensorpack; print(tensorpack.__version__)'`
.
+
Tensorpack version:
`python -c 'import tensorpack; print(tensorpack.__version__)'`
.
You can install Tensorpack master by
`pip install -U git+https://github.com/ppwwyyxx/tensorpack.git`
.:
You can install Tensorpack master by
`pip install -U git+https://github.com/ppwwyyxx/tensorpack.git`
.:
+
Hardware information,
if relevant
.
+
Hardware information,
e.g. number of GPUs used
.
About efficiency issues, PLEASE first read http://tensorpack.readthedocs.io/en/latest/tutorial/performance-tuning.html
About efficiency issues, PLEASE first read http://tensorpack.readthedocs.io/en/latest/tutorial/performance-tuning.html
.github/ISSUE_TEMPLATE/using-understanding-tensorpack.md
View file @
193f6056
...
@@ -4,6 +4,9 @@ about: More general questions about Tensorpack.
...
@@ -4,6 +4,9 @@ about: More general questions about Tensorpack.
---
---
+
If you did something specific and it failed, please use the "Unexpected Problems /
Bugs" category.
+
Your question is probably answered in
[
tutorials
](
http://tensorpack.readthedocs.io/en/latest/tutorial/index.html#user-tutorials
)
. Read it first.
+
Your question is probably answered in
[
tutorials
](
http://tensorpack.readthedocs.io/en/latest/tutorial/index.html#user-tutorials
)
. Read it first.
+
We answer "HOW to do X with Tensorpack" for a well-defined X.
+
We answer "HOW to do X with Tensorpack" for a well-defined X.
...
...
docs/modules/callbacks.rst
View file @
193f6056
tensorpack.callbacks package
tensorpack.callbacks package
============================
============================
__Everything__
other than the training iterations happen in the callbacks.
**Everything**
other than the training iterations happen in the callbacks.
Most of the fancy things you want to do will probably end up here.
Most of the fancy things you want to do will probably end up here.
See relevant tutorials: :doc:`../tutorial/callback`.
See relevant tutorials: :doc:`../tutorial/callback`.
...
...
docs/modules/utils.rst
View file @
193f6056
...
@@ -52,7 +52,7 @@ tensorpack.utils.serialize module
...
@@ -52,7 +52,7 @@ tensorpack.utils.serialize module
:show-inheritance:
:show-inheritance:
tensorpack.utils.compatible_serialize module
tensorpack.utils.compatible_serialize module
---------------------------------
---------------------------------
-----------
.. automodule:: tensorpack.utils.compatible_serialize
.. automodule:: tensorpack.utils.compatible_serialize
:members:
:members:
...
...
docs/tutorial/extend/callback.md
View file @
193f6056
...
@@ -126,3 +126,8 @@ You can overwrite any of the following methods to define a new callback:
...
@@ -126,3 +126,8 @@ You can overwrite any of the following methods to define a new callback:
or
[
EnableCallbackIf
](
../../modules/callbacks.html#tensorpack.callbacks.EnableCallbackIf
)
.
or
[
EnableCallbackIf
](
../../modules/callbacks.html#tensorpack.callbacks.EnableCallbackIf
)
.
Of course you also have the freedom to implement "what to do" and "when to do" altogether.
Of course you also have the freedom to implement "what to do" and "when to do" altogether.
### Examples
Check source code of the
[
existing tensorpack callbacks
](
../../modules/callbacks.html
)
.
Or grep 'Callback' in tensorpack examples for those implemented as extensions.
examples/FasterRCNN/config.py
View file @
193f6056
...
@@ -22,6 +22,11 @@ class AttrDict():
...
@@ -22,6 +22,11 @@ class AttrDict():
setattr
(
self
,
name
,
ret
)
setattr
(
self
,
name
,
ret
)
return
ret
return
ret
def
__setattr__
(
self
,
name
,
value
):
if
self
.
_freezed
and
name
not
in
self
.
__dict__
:
raise
AttributeError
(
"Cannot create new attribute!"
)
super
()
.
__setattr__
(
name
,
value
)
def
__str__
(
self
):
def
__str__
(
self
):
return
pprint
.
pformat
(
self
.
to_dict
(),
indent
=
1
)
return
pprint
.
pformat
(
self
.
to_dict
(),
indent
=
1
)
...
@@ -51,6 +56,9 @@ class AttrDict():
...
@@ -51,6 +56,9 @@ class AttrDict():
def
freeze
(
self
):
def
freeze
(
self
):
self
.
_freezed
=
True
self
.
_freezed
=
True
for
v
in
self
.
__dict__
.
values
():
if
isinstance
(
v
,
AttrDict
):
v
.
freeze
()
# avoid silent bugs
# avoid silent bugs
def
__eq__
(
self
,
_
):
def
__eq__
(
self
,
_
):
...
@@ -229,6 +237,7 @@ def finalize_configs(is_training):
...
@@ -229,6 +237,7 @@ def finalize_configs(is_training):
else
:
else
:
assert
'OMPI_COMM_WORLD_SIZE'
not
in
os
.
environ
assert
'OMPI_COMM_WORLD_SIZE'
not
in
os
.
environ
ngpu
=
get_num_gpu
()
ngpu
=
get_num_gpu
()
assert
ngpu
>
0
,
"Has to run with GPU!"
assert
ngpu
%
8
==
0
or
8
%
ngpu
==
0
,
ngpu
assert
ngpu
%
8
==
0
or
8
%
ngpu
==
0
,
ngpu
if
_C
.
TRAIN
.
NUM_GPUS
is
None
:
if
_C
.
TRAIN
.
NUM_GPUS
is
None
:
_C
.
TRAIN
.
NUM_GPUS
=
ngpu
_C
.
TRAIN
.
NUM_GPUS
=
ngpu
...
...
tensorpack/callbacks/inference.py
View file @
193f6056
...
@@ -117,7 +117,7 @@ class ScalarStats(Inferencer):
...
@@ -117,7 +117,7 @@ class ScalarStats(Inferencer):
class
ClassificationError
(
Inferencer
):
class
ClassificationError
(
Inferencer
):
"""
"""
Compute
__true__
classification error in batch mode, from a ``wrong`` tensor.
Compute
**true**
classification error in batch mode, from a ``wrong`` tensor.
The ``wrong`` tensor is supposed to be an binary vector containing
The ``wrong`` tensor is supposed to be an binary vector containing
whether each sample in the batch is *incorrectly* classified.
whether each sample in the batch is *incorrectly* classified.
...
...
tensorpack/callbacks/misc.py
View file @
193f6056
...
@@ -42,7 +42,7 @@ class InjectShell(Callback):
...
@@ -42,7 +42,7 @@ class InjectShell(Callback):
Example:
Example:
.. code-block::
python
.. code-block::
none
callbacks=[InjectShell('/path/to/pause-training.tmp'), ...]
callbacks=[InjectShell('/path/to/pause-training.tmp'), ...]
...
...
tensorpack/callbacks/monitor.py
View file @
193f6056
...
@@ -16,6 +16,7 @@ import re
...
@@ -16,6 +16,7 @@ import re
import
tensorflow
as
tf
import
tensorflow
as
tf
from
..utils
import
logger
from
..utils
import
logger
from
..tfutils.summary
import
create_scalar_summary
,
create_image_summary
from
..tfutils.summary
import
create_scalar_summary
,
create_image_summary
from
..utils.develop
import
HIDE_DOC
from
.base
import
Callback
from
.base
import
Callback
__all__
=
[
'TrainingMonitor'
,
'Monitors'
,
__all__
=
[
'TrainingMonitor'
,
'Monitors'
,
...
@@ -242,9 +243,11 @@ class TFEventWriter(TrainingMonitor):
...
@@ -242,9 +243,11 @@ class TFEventWriter(TrainingMonitor):
self
.
_logdir
,
graph
=
tf
.
get_default_graph
(),
self
.
_logdir
,
graph
=
tf
.
get_default_graph
(),
max_queue
=
self
.
_max_queue
,
flush_secs
=
self
.
_flush_secs
)
max_queue
=
self
.
_max_queue
,
flush_secs
=
self
.
_flush_secs
)
@
HIDE_DOC
def
process_summary
(
self
,
summary
):
def
process_summary
(
self
,
summary
):
self
.
_writer
.
add_summary
(
summary
,
self
.
global_step
)
self
.
_writer
.
add_summary
(
summary
,
self
.
global_step
)
@
HIDE_DOC
def
process_event
(
self
,
evt
):
def
process_event
(
self
,
evt
):
self
.
_writer
.
add_event
(
evt
)
self
.
_writer
.
add_event
(
evt
)
...
@@ -345,6 +348,7 @@ class JSONWriter(TrainingMonitor):
...
@@ -345,6 +348,7 @@ class JSONWriter(TrainingMonitor):
def
_trigger_epoch
(
self
):
def
_trigger_epoch
(
self
):
self
.
_trigger
()
self
.
_trigger
()
@
HIDE_DOC
def
process_scalar
(
self
,
name
,
val
):
def
process_scalar
(
self
,
name
,
val
):
self
.
_stat_now
[
name
]
=
val
self
.
_stat_now
[
name
]
=
val
...
@@ -417,6 +421,7 @@ class ScalarPrinter(TrainingMonitor):
...
@@ -417,6 +421,7 @@ class ScalarPrinter(TrainingMonitor):
if
self
.
_enable_epoch
:
if
self
.
_enable_epoch
:
self
.
_trigger
()
self
.
_trigger
()
@
HIDE_DOC
def
process_scalar
(
self
,
name
,
val
):
def
process_scalar
(
self
,
name
,
val
):
self
.
_dic
[
name
]
=
float
(
val
)
self
.
_dic
[
name
]
=
float
(
val
)
...
@@ -444,6 +449,7 @@ class ScalarHistory(TrainingMonitor):
...
@@ -444,6 +449,7 @@ class ScalarHistory(TrainingMonitor):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
_dic
=
defaultdict
(
list
)
self
.
_dic
=
defaultdict
(
list
)
@
HIDE_DOC
def
process_scalar
(
self
,
name
,
val
):
def
process_scalar
(
self
,
name
,
val
):
self
.
_dic
[
name
]
.
append
(
float
(
val
))
self
.
_dic
[
name
]
.
append
(
float
(
val
))
...
@@ -488,6 +494,7 @@ class SendMonitorData(TrainingMonitor):
...
@@ -488,6 +494,7 @@ class SendMonitorData(TrainingMonitor):
self
.
names
=
names
self
.
names
=
names
self
.
dic
=
{}
self
.
dic
=
{}
@
HIDE_DOC
def
process_scalar
(
self
,
name
,
val
):
def
process_scalar
(
self
,
name
,
val
):
if
name
in
self
.
names
:
if
name
in
self
.
names
:
self
.
dic
[
name
]
=
val
self
.
dic
[
name
]
=
val
...
...
tensorpack/callbacks/summary.py
View file @
193f6056
...
@@ -114,9 +114,6 @@ def MergeAllSummaries(period=0, run_alone=False, key=tf.GraphKeys.SUMMARIES):
...
@@ -114,9 +114,6 @@ def MergeAllSummaries(period=0, run_alone=False, key=tf.GraphKeys.SUMMARIES):
depend on inputs.
depend on inputs.
key (str): the collection of summary tensors. Same as in `tf.summary.merge_all`.
key (str): the collection of summary tensors. Same as in `tf.summary.merge_all`.
Default is ``tf.GraphKeys.SUMMARIES``
Default is ``tf.GraphKeys.SUMMARIES``
Returns:
a Callback.
"""
"""
period
=
int
(
period
)
period
=
int
(
period
)
if
run_alone
:
if
run_alone
:
...
...
tensorpack/input_source/input_source.py
View file @
193f6056
...
@@ -623,7 +623,9 @@ class StagingInput(FeedfreeInput):
...
@@ -623,7 +623,9 @@ class StagingInput(FeedfreeInput):
# TODO tensorflow/benchmarks use static shapes here,
# TODO tensorflow/benchmarks use static shapes here,
# though it doesn't seem to help. We can use it when it's known.
# though it doesn't seem to help. We can use it when it's known.
stage
=
StagingArea
(
dtypes
,
shapes
=
None
)
# Setting capacity to 1 to potentially save some memory, because we should
# expect the consumers to run slower than the producer.
stage
=
StagingArea
(
dtypes
,
shapes
=
None
,
capacity
=
1
)
# put & get automatically inherit the name scope from the area
# put & get automatically inherit the name scope from the area
self
.
_stage_ops
.
append
(
stage
.
put
(
inputs
))
self
.
_stage_ops
.
append
(
stage
.
put
(
inputs
))
...
...
tensorpack/libinfo.py
View file @
193f6056
...
@@ -54,4 +54,4 @@ except ImportError:
...
@@ -54,4 +54,4 @@ except ImportError:
# This line has to be the last line of the file.
# This line has to be the last line of the file.
# setup.py will use it to determine the version
# setup.py will use it to determine the version
__version__
=
'0.8.
8
'
__version__
=
'0.8.
9
'
tensorpack/models/tflayer.py
View file @
193f6056
...
@@ -9,6 +9,8 @@ from ..utils.argtools import get_data_format
...
@@ -9,6 +9,8 @@ from ..utils.argtools import get_data_format
from
..tfutils.common
import
get_tf_version_tuple
from
..tfutils.common
import
get_tf_version_tuple
from
..tfutils.varreplace
import
custom_getter_scope
from
..tfutils.varreplace
import
custom_getter_scope
__all__
=
[]
def
map_common_tfargs
(
kwargs
):
def
map_common_tfargs
(
kwargs
):
df
=
kwargs
.
pop
(
'data_format'
,
None
)
df
=
kwargs
.
pop
(
'data_format'
,
None
)
...
...
tensorpack/tfutils/sesscreate.py
View file @
193f6056
...
@@ -34,7 +34,7 @@ class NewSessionCreator(tf.train.ChiefSessionCreator):
...
@@ -34,7 +34,7 @@ class NewSessionCreator(tf.train.ChiefSessionCreator):
else
:
else
:
self
.
user_provided_config
=
True
self
.
user_provided_config
=
True
logger
.
warn
(
logger
.
warn
(
"
Some options in
custom session config may not work due to TF
\
"
User-provided
custom session config may not work due to TF
\
bugs. See https://github.com/tensorpack/tensorpack/issues/497 for workarounds."
)
bugs. See https://github.com/tensorpack/tensorpack/issues/497 for workarounds."
)
self
.
config
=
config
self
.
config
=
config
...
...
tensorpack/utils/concurrency.py
View file @
193f6056
...
@@ -251,15 +251,15 @@ def subproc_call(cmd, timeout=None):
...
@@ -251,15 +251,15 @@ def subproc_call(cmd, timeout=None):
shell
=
True
,
timeout
=
timeout
)
shell
=
True
,
timeout
=
timeout
)
return
output
,
0
return
output
,
0
except
subprocess
.
TimeoutExpired
as
e
:
except
subprocess
.
TimeoutExpired
as
e
:
logger
.
warn
(
"Command
timeout!"
)
logger
.
warn
(
"Command
'{}' timeout!"
.
format
(
cmd
)
)
logger
.
warn
(
e
.
output
.
decode
(
'utf-8'
))
logger
.
warn
(
e
.
output
.
decode
(
'utf-8'
))
return
e
.
output
,
-
1
return
e
.
output
,
-
1
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
logger
.
warn
(
"Command
failed: {}"
.
format
(
e
.
returncode
))
logger
.
warn
(
"Command
'{}' failed, return code={}"
.
format
(
cmd
,
e
.
returncode
))
logger
.
warn
(
e
.
output
.
decode
(
'utf-8'
))
logger
.
warn
(
e
.
output
.
decode
(
'utf-8'
))
return
e
.
output
,
e
.
returncode
return
e
.
output
,
e
.
returncode
except
Exception
:
except
Exception
:
logger
.
warn
(
"Command
failed to run: {}
"
.
format
(
cmd
))
logger
.
warn
(
"Command
'{}' failed to run.
"
.
format
(
cmd
))
return
""
,
-
2
return
""
,
-
2
...
...
tensorpack/utils/develop.py
View file @
193f6056
...
@@ -15,6 +15,8 @@ import six
...
@@ -15,6 +15,8 @@ import six
from
.
import
logger
from
.
import
logger
__all__
=
[]
def
create_dummy_class
(
klass
,
dependency
):
def
create_dummy_class
(
klass
,
dependency
):
"""
"""
...
...
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