Deploying models

A quickstart guide for model deployment.
You'll need to do two things before deploying a model:
  1. 1.
    Install the Baseten Python client with pip install --upgrade baseten
  2. 2.
    Create an API key for your Baseten account
This is a quickstart guide, so let's work with a simple model: an sklearn Iris classifier. But the following steps will work for any model built with Hugging Face, LightGBM, MLflow, PyTorch, scikit-learn, Tensorflow, or XGBoost.
Sample model training code:
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
iris = load_iris()
data_x = iris['data']
data_y = iris['target']
model = RandomForestClassifier(), data_y)

Deploying the model

Using your API key and the Baseten Python client, run the following code to deploy your model:
import baseten
model_name="My wonderful model"
Once deployment is complete, you'll receive an email. Your model will be deployed as a draft, which you can invoke and test to make sure everything is working as expected.
For more configuration and control during model deployment, see advanced model deployment.

Publishing the model

Once you're happy with your deployed model, it's time to publish it to production. From the model's page in the Baseten UI, click on the three-dot menu next to "Draft" and select "Publish model version."
Publish model version
Your model will rebuild onto production infrastructure and you will receive an email when the process is complete.
Workspaces on the free Personal plan are limited to a single published model version. To increase the number of models for your workspace, upgrade to a paid Baseten plan.

Pre-trained models

Baseten offers over two dozen pre-trained models that can be deployed for free to your account to explore Baseten's features.