lightning/pl_examples/basic_examples
Adrian Wälchli 5ade197580
Update README page in pl_examples folder (#10114)
Co-authored-by: tchaton <thomas@grid.ai>
2021-10-26 17:38:56 +00:00
..
README.md Update README page in pl_examples folder (#10114) 2021-10-26 17:38:56 +00:00
__init__.py changes examples to pl_examples for name connflict 2019-10-19 00:41:17 +02:00
autoencoder.py remove dataloader patching on the LightningModule (#9764) 2021-10-20 15:23:20 +02:00
backbone_image_classifier.py remove dataloader patching on the LightningModule (#9764) 2021-10-20 15:23:20 +02:00
dali_image_classifier.py remove dataloader patching on the LightningModule (#9764) 2021-10-20 15:23:20 +02:00
mnist_datamodule.py Add KFold Loop example (#9965) 2021-10-18 16:27:12 +01:00
profiler_example.py [bugfix] Resolve example after LightningCLI update (#9520) 2021-09-15 12:31:41 +05:30
simple_image_classifier.py remove dataloader patching on the LightningModule (#9764) 2021-10-20 15:23:20 +02:00

README.md

Basic Examples

Use these examples to test how Lightning works.

MNIST

Trains MNIST where the model is defined inside the LightningModule.

# cpu
python simple_image_classifier.py

# gpus (any number)
python simple_image_classifier.py --trainer.gpus 2

# Distributed Data Parallel
python simple_image_classifier.py --trainer.gpus 2 --trainer.accelerator ddp

MNIST with DALI

The MNIST example above using NVIDIA DALI. Requires NVIDIA DALI to be installed based on your CUDA version, see here.

python dali_image_classifier.py

Image classifier

Generic image classifier with an arbitrary backbone (ie: a simple system)

# cpu
python backbone_image_classifier.py

# gpus (any number)
python backbone_image_classifier.py --trainer.gpus 2

# Distributed Data Parallel
python backbone_image_classifier.py --trainer.gpus 2 --trainer.accelerator ddp

Autoencoder

Showing the power of a system... arbitrarily complex training loops

# cpu
python autoencoder.py

# gpus (any number)
python autoencoder.py --trainer.gpus 2

# Distributed Data Parallel
python autoencoder.py --trainer.gpus 2 --trainer.accelerator ddp