lightning/examples/pl_basics
Vasilis Vryniotis 7e9e441843
Use TorchVision's Multi-weight Support and Model Registration API on Lightning (#14567)
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2022-09-09 20:04:57 +00:00
..
README.md [Docs] Fix README.md in lightning/examples/pl_basics (#13380) 2022-06-30 00:18:07 +09:00
autoencoder.py Standalone Lite: Remaining Utilities (#14492) 2022-09-07 15:25:23 +00:00
backbone_image_classifier.py Promote the CLI out of utilities (#13767) 2022-07-23 12:07:29 +00:00
profiler_example.py Use TorchVision's Multi-weight Support and Model Registration API on Lightning (#14567) 2022-09-09 20:04:57 +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