[Docs] Fix README.md in lightning/examples/pl_basics (#13380)

* Change the path of the command execution folder from mnist_examples to convert_from_pt_to_pl

* Add a guide to add PYTHONPATH

* Fix Lightning Lite link

* Remove duplicate

* Add note

Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
This commit is contained in:
Keiichi Kuroyanagi 2022-06-30 00:18:07 +09:00 committed by GitHub
parent ddbf95516b
commit 1c05a9e597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 74 deletions

View File

@ -5,6 +5,12 @@ can be found in our sister library [Lightning Bolts](https://pytorch-lightning.r
______________________________________________________________________
*Note that some examples may rely on new features that are only available in the development branch and may be incompatible with any releases.*
*If you see any errors, you might want to consider switching to a version tag you would like to run examples with.*
*For example, if you're using `pytorch-lightning==1.6.4` in your environment and seeing issues, run examples of the tag [1.6.4](https://github.com/Lightning-AI/lightning/tree/1.6.4/pl_examples).*
______________________________________________________________________
## MNIST Examples
5 MNIST examples showing how to gradually convert from pure PyTorch to PyTorch Lightning.

View File

@ -2,7 +2,7 @@
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.
The transition through [LightningLite](https://pytorch-lightning.readthedocs.io/en/stable/starter/lightning_lite.html) from pure PyTorch is optional but it might be helpful to learn about it.
#### 1. Image Classifier with Vanilla PyTorch

View File

@ -2,77 +2,7 @@
Use these examples to test how Lightning works.
## 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/stable/starter/lightning_lite.html) 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 mnist_examples/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 mnist_examples/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 mnist_examples/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 the Lightning ecosystem.
```bash
# CPU
python mnist_examples/image_classifier_4_lightning_module.py
# GPUs (any number)
python mnist_examples/image_classifier_4_lightning_module.py --trainer.accelerator 'gpu' --trainer.devices 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 mnist_examples/image_classifier_5_lightning_datamodule.py
# GPUs (any number)
python mnist_examples/image_classifier_5_lightning_datamodule.py --trainer.accelerator 'gpu' --trainer.devices 2
# Distributed Data Parallel (DDP)
python mnist_examples/image_classifier_5_lightning_datamodule.py --trainer.accelerator 'gpu' --trainer.devices 2 --trainer.strategy 'ddp'
```
______________________________________________________________________
#### AutoEncoder
### AutoEncoder
This script shows you how to implement a CNN auto-encoder.
@ -89,7 +19,7 @@ python autoencoder.py --trainer.accelerator 'gpu' --trainer.devices 2 --trainer.
______________________________________________________________________
#### Backbone Image Classifier
### Backbone Image Classifier
This script shows you how to implement a `LightningModule` as a system.
A system describes a `LightningModule` which takes a single `torch.nn.Module` which makes exporting to producion simpler.
@ -107,7 +37,7 @@ python backbone_image_classifier.py --trainer.accelerator 'gpu' --trainer.device
______________________________________________________________________
#### PyTorch Profiler
### PyTorch Profiler
This script shows you how to activate the [PyTorch Profiler](https://github.com/pytorch/kineto) with Lightning.