> For the complete documentation index, see [llms.txt](https://arash.gitbook.io/rptu-ai-toolkit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arash.gitbook.io/rptu-ai-toolkit/train.md).

# Train

```markup
This is where we train a point cloud classification model
 using PyTorch Lightning and MinkowskiEngine.

We first set up DataLoader instances for the training and validation datasets,
 and configures a PyTorch Lightning Trainer instance to manage the training process,
 then saves the trained model.

The training will stop if the validation loss does not improve after a
 specific number of epochs, the best model will be saved.


Functions:
  train_main(model, model_save_path, num_workers): 
    The main function to train the model, taking the model instance,
    the path to save the trained model, and the number of workers to use
    for data loading.





```
