-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Tony-Y/update-docs
Update docs
- Loading branch information
Showing
12 changed files
with
594 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
include test/__init__.py | ||
include examples/plots/README.md | ||
include examples/plots/*.py | ||
include examples/plots/figs/*.png | ||
include examples/emnist/README.md | ||
include examples/emnist/*.py | ||
include examples/emnist/figs/*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# EMNIST Example | ||
|
||
Requirements: `pytorch_warmup` and `torchvision`. | ||
|
||
<p align="center"> | ||
<img src="https://github.com/Tony-Y/pytorch_warmup/raw/master/examples/emnist/figs/accuracy.png" alt="Accuracy" width="400"/></br> | ||
<i>Test accuracy over time for each warmup schedule.</i> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src="https://github.com/Tony-Y/pytorch_warmup/raw/master/examples/emnist/figs/learning_rate.png" alt="Accuracy" width="400"/></br> | ||
<i>Learning rate over time for each warmup schedule.</i> | ||
</p> | ||
|
||
## Download EMNIST Dataset | ||
|
||
Run the Python script `download.py` to download the EMNIST dataset: | ||
|
||
```shell | ||
python download.py | ||
``` | ||
|
||
This script shows download progress: | ||
|
||
``` | ||
Downloading zip archive | ||
Downloading https://biometrics.nist.gov/cs_links/EMNIST/gzip.zip to .data/EMNIST/raw/gzip.zip | ||
100.0% | ||
``` | ||
|
||
## Train A CNN Model | ||
|
||
Run the Python script `main.py` to train a CNN model on the EMNIST dataset using the Adam algorithm. | ||
|
||
### Untuned Linear Warmup | ||
|
||
Train a CNN model with the *Untuned Linear Warmup* schedule: | ||
|
||
``` | ||
python main.py --warmup linear | ||
``` | ||
|
||
### Untuned Exponential Warmup | ||
|
||
Train a CNN model with the *Untuned Exponential Warmup* schedule: | ||
|
||
``` | ||
python main.py --warmup exponential | ||
``` | ||
|
||
### RAdam Warmup | ||
|
||
Train a CNN model with the *RAdam Warmup* schedule: | ||
|
||
``` | ||
python main.py --warmup radam | ||
``` | ||
|
||
### No Warmup | ||
|
||
Train a CNN model without warmup: | ||
|
||
``` | ||
python main.py --warmup none | ||
``` | ||
|
||
### Usage | ||
|
||
``` | ||
usage: main.py [-h] [--batch-size N] [--test-batch-size N] [--epochs N] [--lr LR] | ||
[--lr-min LM] [--wd WD] [--beta2 B2] [--no-cuda] [--seed S] | ||
[--log-interval N] [--warmup {linear,exponential,radam,none}] [--save-model] | ||
PyTorch EMNIST Example | ||
options: | ||
-h, --help show this help message and exit | ||
--batch-size N input batch size for training (default: 64) | ||
--test-batch-size N input batch size for testing (default: 1000) | ||
--epochs N number of epochs to train (default: 10) | ||
--lr LR base learning rate (default: 0.01) | ||
--lr-min LM minimum learning rate (default: 1e-5) | ||
--wd WD weight decay (default: 0.01) | ||
--beta2 B2 Adam's beta2 parameter (default: 0.999) | ||
--no-cuda disables CUDA training | ||
--seed S random seed (default: 1) | ||
--log-interval N how many batches to wait before logging training status | ||
--warmup {linear,exponential,radam,none} | ||
warmup schedule | ||
--save-model For Saving the current Model | ||
``` | ||
|
||
© 2024 Takenori Yamamoto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Plots | ||
|
||
Requirements: `pytorch_warmup` and `matplotlib`. | ||
|
||
## Effective Warmup Period | ||
|
||
<p align="center"> | ||
<img src="https://github.com/Tony-Y/pytorch_warmup/raw/master/examples/plots/figs/warmup_period.png" alt="Warmup period" width="400"/></br> | ||
<i>Effective warmup periods of RAdam and rule-of-thumb warmup schedules, as a function of β₂.</i> | ||
</p> | ||
|
||
Run the Python script `effective_warmup_period.py` to show up the figure above: | ||
|
||
```shell | ||
python effective_warmup_period.py | ||
``` | ||
|
||
### Usage | ||
|
||
``` | ||
usage: effective_warmup_period.py [-h] [--output {none,png,pdf}] | ||
Effective warmup period | ||
options: | ||
-h, --help show this help message and exit | ||
--output {none,png,pdf} | ||
Output file type (default: none) | ||
``` | ||
|
||
## Warmup Schedule | ||
|
||
<p align="center"> | ||
<img src="https://github.com/Tony-Y/pytorch_warmup/raw/master/examples/plots/figs/warmup_schedule.png" alt="Warmup schedule" width="400"/></br> | ||
<i>RAdam and rule-of-thumb warmup schedules over time for β₂ = 0.999.</i> | ||
</p> | ||
|
||
Run the Python script `warmup_schedule.py` to show up the figure above: | ||
|
||
```shell | ||
python warmup_schedule.py | ||
``` | ||
|
||
### Usage | ||
|
||
``` | ||
usage: warmup_schedule.py [-h] [--output {none,png,pdf}] | ||
Warmup schedule | ||
options: | ||
-h, --help show this help message and exit | ||
--output {none,png,pdf} | ||
Output file type (default: none) | ||
``` | ||
|
||
© 2024 Takenori Yamamoto |
Oops, something went wrong.