|
| 1 | +# KFAC-JAX Examples |
| 2 | + |
| 3 | +This folder contains code with common functionality used in all examples, and |
| 4 | +the examples subfolders as well. |
| 5 | +Each example follows the following structure: |
| 6 | +* `experiment.py` has the model definition, loss definition, and pipeline |
| 7 | +experiment class. |
| 8 | +* `pipeline.py` has the hyper-parameter configuration. |
| 9 | + |
| 10 | + |
| 11 | +To run the examples you will need to install additional dependencies via: |
| 12 | + |
| 13 | +```shell |
| 14 | +$ pip install -r examples/requirements.txt |
| 15 | +``` |
| 16 | + |
| 17 | +To run an example simply do: |
| 18 | + |
| 19 | +```shell |
| 20 | +$ python example_name/pipeline.py |
| 21 | +``` |
| 22 | + |
| 23 | +## Autoencoder on MNIST |
| 24 | + |
| 25 | +This example uses the K-FAC optimizer to perform deterministic (i.e. full batch) |
| 26 | +training of a deep autoencoder on MNIST. |
| 27 | +The default configuration uses the automatic learning rate, momentum, and |
| 28 | +damping adaptation techniques from the original K-FAC paper. |
| 29 | + |
| 30 | +## Classifier on MNIST |
| 31 | + |
| 32 | +This example uses the K-FAC optimizer to perform deterministic (i.e. full batch) |
| 33 | +training of a very small convolutional network for MNIST classification. |
| 34 | +The default configuration uses the automatic learning rate, momentum, and |
| 35 | +damping adaptation techniques from the original K-FAC paper. |
| 36 | + |
| 37 | +## Resnet50 on ImageNet |
| 38 | + |
| 39 | +This example uses the K-FAC optimizer to perform stochastic training (with |
| 40 | +fixed batch size) of a Resnet50 network for ImageNet classification. |
| 41 | +The default configuration uses the automatic damping adaptation technique from |
| 42 | +the original K-FAC paper. |
| 43 | +The momentum is fixed at `0.9` and the learning rate follows an ad-hoc schedule. |
| 44 | + |
| 45 | + |
| 46 | +## Resnet101 with TAT on ImageNet |
| 47 | + |
| 48 | +This example uses the K-FAC optimizer to perform stochastic training (with |
| 49 | +fixed batch size) of a Resnet101 network for ImageNet classification, |
| 50 | +with no residual connections or normalization layers as in the |
| 51 | +[TAT paper]. |
| 52 | +The default configuration uses a fixed damping of `0.001`. |
| 53 | +The momentum is fixed at `0.9` and the learning rate follows a cosine decay |
| 54 | +schedule. |
| 55 | + |
| 56 | +[TAT paper]: https://arxiv.org/abs/2203.08120 |
0 commit comments