Commit f43309f0 authored by Yuxin Wu's avatar Yuxin Wu

update docs

parent 47de91da
......@@ -116,7 +116,7 @@ training:
1. The model (the graph): you've already written it yourself with TF symbolic functions.
Nothing about it is related to the tensorpack interface.
If you use tensorpack layers, they are mainly just wrappers around `tf.layers`.
If you use tensorpack layers, they are not so different from `tf.layers`.
2. The trained parameters: tensorpack saves them in standard TF checkpoint format.
Nothing about the format is related to tensorpack.
......@@ -139,6 +139,8 @@ with TowerContext('', is_training=False):
```eval_rst
.. note:: **Do not use metagraph for inference!**
Tensorpack saves a metagraph during training. Users should not try to load it for inference.
Metagraph is the wrong abstraction for a "model".
It stores the entire graph which contains not only the mathematical model, but also all the
training settings (queues, iterators, summaries, evaluations, multi-gpu replications).
......
......@@ -28,7 +28,7 @@ Some practicical notes:
### To test a model:
Download models from [model zoo](http://models.tensorpack.com/OpenAIGym/).
Download models from [model zoo](http://models.tensorpack.com/#OpenAIGym).
Watch the agent play:
`./train-atari.py --task play --env Breakout-v0 --load Breakout-v0.npz`
......
Example code to convert, load and run inference of some Caffe models.
Require caffe python bindings to be installed.
Converted models can also be found at [tensorpack model zoo](http://models.tensorpack.com).
Converted models can also be found at [tensorpack model zoo](http://models.tensorpack.com/#Caffe-Converted).
## AlexNet:
Download: https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet
......
......@@ -46,7 +46,7 @@ In this implementation, quantized operations are all performed through `tf.float
+ Look at the docstring in `*-dorefa.py` to see detailed usage and performance.
Pretrained model for (1,4,32)-ResNet18 and several AlexNet are available at
[tensorpack model zoo](http://models.tensorpack.com/DoReFa-Net/).
[tensorpack model zoo](http://models.tensorpack.com/#DoReFa-Net).
They're provided in the format of numpy dictionary.
The __binary-weight 4-bit-activation ResNet-18__ model has 59.2% top-1 validation accuracy.
......
This diff is collapsed.
......@@ -140,7 +140,7 @@ _C.TRAIN.STARTING_EPOCH = 1 # the first epoch to start with, useful to continue
# Therefore, there is *no need* to modify the config if you only change the number of GPUs.
_C.TRAIN.LR_SCHEDULE = "1x" # "1x" schedule in detectron
_C.TRAIN.EVAL_PERIOD = 25 # period (epochs) to run evaluation
_C.TRAIN.EVAL_PERIOD = 50 # period (epochs) to run evaluation
_C.TRAIN.CHECKPOINT_PERIOD = 20 # period (epochs) to save model
# preprocessing --------------------
......
......@@ -17,7 +17,7 @@ from GAN import GANModelDesc, GANTrainer
Boundary Equilibrium GAN.
See the docstring in DCGAN.py for usage.
A pretrained model on CelebA is at http://models.tensorpack.com/GAN/
A pretrained model on CelebA is at http://models.tensorpack.com/#GAN
"""
......
......@@ -30,7 +30,7 @@ from GAN import GANModelDesc, GANTrainer, RandomZData
You can also train on other images (just use any directory of jpg files in
`--data`). But you may need to change the preprocessing.
A pretrained model on CelebA is at http://models.tensorpack.com/GAN/
A pretrained model on CelebA is at http://models.tensorpack.com/#GAN
"""
......
......@@ -24,7 +24,7 @@ To train:
To visualize:
./InfoGAN-mnist.py --sample --load path/to/model
A pretrained model is at http://models.tensorpack.com/GAN/
A pretrained model is at http://models.tensorpack.com/#GAN
"""
BATCH = 128
......
......@@ -33,4 +33,4 @@ To inference (produce a heatmap at each level at out*.png):
```bash
./hed.py --load pretrained.model --run a.jpg
```
Models I trained can be downloaded [here](http://models.tensorpack.com/HED/).
Models I trained can be downloaded [here](http://models.tensorpack.com/#HED).
......@@ -4,7 +4,7 @@ ImageNet training code of ResNet, ShuffleNet, DoReFa-Net, AlexNet, Inception, VG
To train any of the models, just do `./{model}.py --data /path/to/ilsvrc`.
More options are available in `./{model}.py --help`.
Expected format of data directory is described in [docs](http://tensorpack.readthedocs.io/modules/dataflow.dataset.html#tensorpack.dataflow.dataset.ILSVRC12).
Some pretrained models can be downloaded at [tensorpack model zoo](http://models.tensorpack.com/).
Some pretrained models can be downloaded at [tensorpack model zoo](http://models.tensorpack.com/#ImageNetModels).
### ShuffleNet
......
......@@ -39,7 +39,7 @@ Usage:
./CAM-resnet.py --data /path/to/imagenet [--load ImageNet-ResNet18-Preact.npz] [--gpu 0,1,2,3]
```
Pretrained and fine-tuned ResNet can be downloaded
in the [model zoo](http://models.tensorpack.com/).
in the [model zoo](http://models.tensorpack.com/#Visualization).
2. Generate CAM on ImageNet validation set:
```bash
......
......@@ -20,7 +20,7 @@ To train (takes about 300 epochs to reach 8.8% error):
./mnist-addition.py
```
To draw the above visualization with [pretrained model](http://models.tensorpack.com/SpatialTransformer/):
To draw the above visualization with [pretrained model](http://models.tensorpack.com/#SpatialTransformer):
```bash
./mnist-addition.py --load mnist-addition.npz --view
```
......@@ -35,7 +35,7 @@ python enet-pat.py --vgg19 /path/to/vgg19.npz --data train2017.lmdb
Training is highly unstable and does not often give good results.
The pretrained model may also fail on different types of images.
You can download and play with the pretrained model [here](http://models.tensorpack.com/SuperResolution/).
You can download and play with the pretrained model [here](http://models.tensorpack.com/#SuperResolution).
3. Inference on an image and output in current directory:
......
......@@ -304,7 +304,7 @@ class SyncMultiGPUReplicatedBuilder(DataParallelBuilder):
with tf.name_scope('sync_variables'):
post_init_op = SyncMultiGPUReplicatedBuilder.get_post_init_ops()
else:
post_init_op = tf.no_op(name='empty_sync_variables')
post_init_op = None
return train_op, post_init_op
# Adopt from https://github.com/tensorflow/benchmarks/blob/master/scripts/tf_cnn_benchmarks/variable_mgr.py
......
......@@ -190,6 +190,7 @@ class SyncMultiGPUTrainerReplicated(SingleCostTrainer):
grad_list = self._builder.call_for_each_tower(tower_fn)
self.train_op, post_init_op = self._builder.build(grad_list, get_opt_fn)
if post_init_op is not None:
cb = RunOp(
post_init_op,
run_before=True,
......@@ -197,6 +198,8 @@ class SyncMultiGPUTrainerReplicated(SingleCostTrainer):
verbose=True)
cb.name_scope = "SyncVariables"
return [cb]
else:
return []
class DistributedTrainerBase(SingleCostTrainer):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment