lightning/examples/pl_basics
Carlos Mocholí 4f53e7132f
Promote the CLI out of utilities (#13767)
2022-07-23 12:07:29 +00:00
..
README.md [Docs] Fix README.md in lightning/examples/pl_basics (#13380) 2022-06-30 00:18:07 +09:00
autoencoder.py Promote the CLI out of utilities (#13767) 2022-07-23 12:07:29 +00:00
backbone_image_classifier.py Promote the CLI out of utilities (#13767) 2022-07-23 12:07:29 +00:00
profiler_example.py Promote the CLI out of utilities (#13767) 2022-07-23 12:07:29 +00: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