Here’s a quick guide on how to use pre-trained models in Slai.
train.py
. Simply import your pre-trained model in train.py
and return the model class in train()
handler.py
. In your handler, you can define how you’d like to handle the inputs and outputs to the pre-trained model. In this example, we’ll pass a string input, and return a JSON object with generated sentences from GPT-2.
Train
to download the pre-trained weights into the sandbox. Once that is complete, you can test the model before deploying.
In the test panel, you’ll get an interactive test utility to send requests to the model. Let’s generate some sentences!
Using the test utility