flâneur — a map of the web's best reading

Trainer — PyTorch Lightning 2.4.0 documentation

lightning.ai · 9,092 words · saved by 1 readers

Once you’ve organized your PyTorch code into a LightningModule, the Trainer automates everything else. The Trainer achieves the following: You maintain control over all aspects via PyTorch code in your LightningModule. The trainer uses best practices embedded by contributors and users from top AI labs such as Facebook AI Research, NYU, MIT, Stanford, etc… The trainer allows disabling any key part that you don’t want automated. This is the basic use of the trainer: The Lightning Trainer does much more than just “training”. Under the hood, it handles all loop details for you, some examples include: Automatically enabling/disabling grads Running the training, validation and test dataloaders Calling the Callbacks at the appropriate times Putting batches and computations on the correct devices Here’s the pseudocode for what the trainer does under the hood (showing the train loop only) In Python scripts, it’s recommended you use a main function to call the Trainer. So you can run it like so:

Trainer ¶ Once you’ve organized your PyTorch code into a LightningModule , the Trainer automates everything else. The Trainer achieves the following: You maintain control over all aspects via PyTorch code in your LightningModule . The trainer uses best practices embedded by contributors and users from top AI labs such as Facebook AI Research, NYU, MIT, Stanford, etc… The trainer allows disabling any key part that you don’t want automated. Basic use ¶ This is the basic use of the trainer: model = MyLightningModule () trainer = Trainer () trainer . fit ( model , train_dataloader , val_dataloader

Explore this link on the map →

related reading