-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kaushik B <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Justus Schock <[email protected]> Co-authored-by: SeanNaren <[email protected]> Co-authored-by: Kaushik B <[email protected]> Co-authored-by: thomas chaton <[email protected]> Co-authored-by: Rohit Gupta <[email protected]> Co-authored-by: four4fish <[email protected]> Co-authored-by: Nicki Skafte Detlefsen <[email protected]> Co-authored-by: Carlos Mocholi <[email protected]> Co-authored-by: Pietro Lesci <[email protected]>
- Loading branch information
1 parent
e4ee6df
commit 3cd65b5
Showing
24 changed files
with
1,016 additions
and
168 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,9 @@ ENV/ | |
Datasets/ | ||
mnist/ | ||
legacy/checkpoints/ | ||
*.gz | ||
*ubyte | ||
|
||
|
||
# pl tests | ||
ml-runs/ | ||
|
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
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,67 @@ | ||
## MNIST Examples | ||
|
||
Here are 5 MNIST examples showing you how to gradually convert from pure PyTorch to PyTorch Lightning. | ||
|
||
The transition through [LightningLite](https://pytorch-lightning.readthedocs.io/en/latest/stable/lightning_lite.rst) from pure PyTorch is optional but it might be helpful to learn about it. | ||
|
||
#### 1. Image Classifier with Vanilla PyTorch | ||
|
||
Trains a simple CNN over MNIST using vanilla PyTorch. | ||
|
||
```bash | ||
# CPU | ||
python image_classifier_1_pytorch.py | ||
``` | ||
|
||
______________________________________________________________________ | ||
|
||
#### 2. Image Classifier with LightningLite | ||
|
||
This script shows you how to scale the previous script to enable GPU and multi-GPU training using [LightningLite](https://pytorch-lightning.readthedocs.io/en/stable/starter/lightning_lite.html). | ||
|
||
```bash | ||
# CPU / multiple GPUs if available | ||
python image_classifier_2_lite.py | ||
``` | ||
|
||
______________________________________________________________________ | ||
|
||
#### 3. Image Classifier - Conversion from Lite to Lightning | ||
|
||
This script shows you how to prepare your conversion from [LightningLite](https://pytorch-lightning.readthedocs.io/en/stable/starter/lightning_lite.html) to `LightningModule`. | ||
|
||
```bash | ||
# CPU / multiple GPUs if available | ||
python image_classifier_3_lite_to_lightning_module.py | ||
``` | ||
|
||
______________________________________________________________________ | ||
|
||
#### 4. Image Classifier with LightningModule | ||
|
||
This script shows you the result of the conversion to the `LightningModule` and finally all the benefits you get from Lightning. | ||
|
||
```bash | ||
# CPU | ||
python image_classifier_4_lightning_module.py | ||
|
||
# GPUs (any number) | ||
python image_classifier_4_lightning_module.py --trainer.gpus 2 | ||
``` | ||
|
||
______________________________________________________________________ | ||
|
||
#### 5. Image Classifier with LightningModule and LightningDataModule | ||
|
||
This script shows you how to extract the data related components into a `LightningDataModule`. | ||
|
||
```bash | ||
# CPU | ||
python image_classifier_5_lightning_datamodule.py | ||
|
||
# GPUs (any number) | ||
python image_classifier_5_lightning_datamodule.py --trainer.gpus 2 | ||
|
||
# Distributed Data parallel | ||
python image_classifier_5_lightning_datamodule.py --trainer.gpus 2 --trainer.strategy 'ddp' | ||
``` |
Empty file.
Oops, something went wrong.