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
7780c64b
Commit
7780c64b
authored
Aug 10, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs
parent
a131b8fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
docs/tutorial/extend/trainer.md
docs/tutorial/extend/trainer.md
+3
-3
docs/tutorial/graph.md
docs/tutorial/graph.md
+12
-4
docs/tutorial/trainer.md
docs/tutorial/trainer.md
+3
-3
No files found.
docs/tutorial/extend/trainer.md
View file @
7780c64b
...
...
@@ -4,11 +4,10 @@
The existing trainers should be enough for single-cost optimization tasks.
If you want to do something different during training, first consider writing it as a callback,
or write an issue to see if there is a better solution than creating new trainers.
For certain tasks, you do need a new trainer.
If your task is fundamentally different from single-cost optimization, you may need to write a trainer.
Trainers just run __some__ iterations, so there is no limit in where the data come from or what to do in an iteration.
The existing common trainers all
do
two things:
The existing common trainers all
implement
two things:
1.
Setup the graph and input pipeline, using the given
`TrainConfig`
.
2.
Minimize
`model.cost`
in each iteration.
...
...
@@ -25,3 +24,4 @@ But you can customize it by using the base `Trainer` class.
2. Subclass `Trainer` and override the `run_step()` method. This way you can do something more than running an op.
There are several different
[
GAN trainers
](
../../examples/GAN/GAN.py
)
for reference.
The implementation of
[
SimpleTrainer
](
https://github.com/ppwwyyxx/tensorpack/blob/master/tensorpack/train/simple.py
)
may also be helpful.
docs/tutorial/graph.md
View file @
7780c64b
...
...
@@ -32,16 +32,24 @@ the argument `inputs` is the list of input tensors matching `_get_inputs`.
You can use any symbolic functions in
`_build_graph`
, including TensorFlow core library
functions and other symbolic libraries.
**How does it work**
: Most tensorpack trainers expect a
`ModelDesc`
.
The trainers will use
`_get_inputs`
to connect
`InputSource`
to the graph,
use
`_build_graph`
to create the backbone model and minimization op, and so on.
### How is it Used:
Most tensorpack trainers expect a
`ModelDesc`
, and use it as a __description
of the TF graph__ (except for the input pipeline).
These trainers will use
`_get_inputs`
to connect the given
`InputSource`
to the graph.
They'll then use
`_build_graph`
to create the backbone model, and then
`_get_optimizer`
to create the minimization op, and run it.
Note that data-parallel multi-GPU trainers will call
`_build_graph`
__multiple times__ on each GPU.
A trainer may also make __extra calls__ to
`_build_graph`
for inference, if used by some callbacks.
`_build_graph`
will always be called under some
`TowerContext`
which contains these information
(e.g. training or inference, reuse or not, scope name) for your access.
Also, to respect variable reuse among multiple calls, use
`tf.get_variable()`
instead of
`tf.Variable`
.
### Build It Manually
When you need to deal with complicated graph, it may be easier to build the graph manually.
You are free to do so as long as you tell the trainer what to do in each step.
Check out
[
Write a Trainer
](
http://
localhost:8000
/tutorial/extend/trainer.html
)
Check out
[
Write a Trainer
](
http://
tensorpack.readthedocs.io/en/latest
/tutorial/extend/trainer.html
)
for using a custom graph with trainer.
docs/tutorial/trainer.md
View file @
7780c64b
...
...
@@ -5,16 +5,16 @@ In research we do training of various kind.
The only assumption tensorpack
`Trainer`
class makes about your training, is that your training
follows this pattern:
```
python
for
epoch_num
in
range
(
starting_epoch
,
max_epoch
s
):
for
epoch_num
in
range
(
starting_epoch
,
max_epoch
):
for
local_step
in
range
(
steps_per_epoch
):
run_step
()
```
1.
Training is
**running some iteration**
.
1.
Training is
**running some iteration
s
**
.
Tensorpack base trainer implements the logic of __running the iteration__.
Users or derived trainers should implement __what the iteration is__.
2.
Trainer assumes the existence of
"epoch", i.e. that the iterations run in double for
loops.
2.
Trainer assumes the existence of
__"epoch"__, i.e. that the iterations run in double for-
loops.
But it doesn't need to be a full pass of your dataset,
``steps_per_epoch``
can be any number you set
and it only affects the
[
schedule of callbacks
](
http://tensorpack.readthedocs.io/en/latest/tutorial/extend/callback.html
)
.
In other words, an "epoch" is the __default period__ to run callbacks (validation, summary, checkpoint, etc.).
...
...
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