Skip to main content
This example is only compatible with CLI v1.20 and later. Should you be making use of an older version of the CLI, please run pip install --upgrade cerebrium to upgrade it to the latest version.
This tutorial covers deploying Mistral 7B using the popular vLLM inference framework. To see the final implementation, you can view it here

Basic Setup

Developing on Cerebrium is similar to a virtual machine or Google Colab. Install the Cerebrium package and log in before proceeding. See the installation docs for details. First, create your project:
Add these Python packages to the [cerebrium.dependencies.pip] section in your cerebrium.toml file:
Create a main.py file. This implementation fits in a single file. Start by defining the request object:
Pydantic handles data validation. The prompt parameter is required; others are optional with default values. A missing prompt triggers an automatic error message.

vLLM Implementation

Model Setup

The model loads outside the predict function since it only needs to load once at startup. The predict function passes input parameters from the request to the model and returns generated outputs.

Deploy

Configure your compute and environment settings in cerebrium.toml:
Deploy the model using this command:
After deployment, make this request:
The endpoint returns results in this format: