Skip to main content
The train.py file is a core building block in Slai. It’s used for:
  • Writing training code for your model
  • Loading pre-trained models
The train.py file has two rules:
  • You need a train() function
  • train() must return a trained model, or an empty object
Here’s a more realistic example, with a basic neural network class that’s returned in the train() function.
You can also return multiple models from train(), like so.
The object returned from train.py will be passed to the handler, which is a wrapper around the model object.