lightning/examples/fabric/build_your_own_trainer
Jirka Borovec 1e88899a51
bump python 3.9+ (#20413)
* bump python 3.9+

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* --unsafe-fixes

* contextlib.AbstractContextManager

* type: ignore[misc]

* update CI

* apply fixes

* apply fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
2024-11-25 09:20:17 +01:00
..
README.md BYOT example (#16938) 2023-03-06 10:26:18 +01:00
run.py Fix configure_optimizers example (#20420) 2024-11-14 23:41:44 +01:00
trainer.py bump python 3.9+ (#20413) 2024-11-25 09:20:17 +01:00

README.md

Build Your Own Trainer (BYOT)

This example demonstrates how easy it is to build a fully customizable trainer for your LightningModule using Fabric. It is built upon lightning.fabric for hardware and training orchestration and consists of two files:

  • trainer.py contains the actual MyCustomTrainer implementation
  • run.py contains a script utilizing this trainer for training a very simple MNIST module.

Run

To run this example, call python run.py

Requirements

This example has the following requirements which need to be installed on your python environment:

  • lightning
  • torchmetrics
  • torch
  • torchvision
  • tqdm

to install them with the appropriate versions run:

pip install "lightning>=2.0" "torchmetrics>=0.11" "torchvision>=0.14" "torch>=1.13" tqdm