lightning/examples/pl_basics
Carlos Mocholí 67eb931cdf Remove the deprecated `LightningCLI` arguments (#16380) 2023-01-19 18:39:36 +01:00
..
README.md [Docs] Fix README.md in lightning/examples/pl_basics (#13380) 2022-06-30 00:18:07 +09:00
autoencoder.py Remove the deprecated `LightningCLI` arguments (#16380) 2023-01-19 18:39:36 +01:00
backbone_image_classifier.py Remove the deprecated `pl.utilities.cli` module (#16116) 2022-12-19 23:24:25 +01:00
profiler_example.py [pre-commit.ci] pre-commit suggestions (#16224) 2023-01-04 18:48:35 -05:00

README.md

Basic Examples

Use these examples to test how Lightning works.

AutoEncoder

This script shows you how to implement a CNN auto-encoder.

# CPU
python autoencoder.py

# GPUs (any number)
python autoencoder.py --trainer.accelerator 'gpu' --trainer.devices 2

# Distributed Data Parallel (DDP)
python autoencoder.py --trainer.accelerator 'gpu' --trainer.devices 2 --trainer.strategy 'ddp'

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.

# CPU
python backbone_image_classifier.py

# GPUs (any number)
python backbone_image_classifier.py --trainer.accelerator 'gpu' --trainer.devices 2

# Distributed Data Parallel (DDP)
python backbone_image_classifier.py --trainer.accelerator 'gpu' --trainer.devices 2 --trainer.strategy 'ddp'

PyTorch Profiler

This script shows you how to activate the PyTorch Profiler with Lightning.

python profiler_example.py