# Custom model in a PPS
URL: https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/deploy-workflows/cus-model-pps-env.html

> How to deploy a custom model in a Portable Prediction Server.

# Deploy a custom model in a Portable Prediction Server

Custom inference models allow you to bring your pre-trained models into DataRobot through the Custom Model Workshop. DataRobot supports custom models built in various programming languages, including Python, R, and Java. Once you've created a custom model in DataRobot, you can deploy it to a containerized DataRobot prediction environment called a Portable Prediction Server (PPS). To deploy a custom model to a PPS, you can prepare and test it in the Custom Model Workshop, and then add it to the Model Registry. You can then deploy the custom model using a PPS bundle, which includes everything you need to deploy the model externally while monitoring it alongside models deployed within DataRobot.

To create and deploy a custom model in a PPS, follow the workflow outlined below:

```
graph TB
  A[Create a custom model] --> B{Custom model environment?} 
  B --> |Yes|C[Create a custom model environment]
  B --> |No|D[Prepare the custom model];
  C --> D
  D --> E{Test locally?}
  E --> |No|H[Test the custom model in DataRobot]
  E --> |Yes|F[Install the DataRobot Model Runner]
  F --> G[Test the custom model locally]
  G --> H
  H --> I[Register the custom model]
  I --> J{Create an external prediction environment?}
  J --> |No|L[Deploy the custom model to an external prediction environment]
  J --> |Yes|K[Add an external prediction environment]
  K --> L 
  L --> M[Deploy the custom model to a PPS]
```

## Create a custom model

Custom inference models are user-created, pre-trained models (made up of a collection of files) uploaded to DataRobot via the Custom Model Workshop.

You can assemble custom inference models in either of the following ways:

- Create a custom modelwithoutproviding the model requirements andstart_server.shfile on theAssembletab. This type of custom modelmustuse a drop-in environment. Drop-in environments contain the requirements andstart_server.shfile used by the model. They areprovided by DataRobotin the Custom Model Workshop. You can alsocreate your owndrop-in custom environment.
- Create a custom modelwiththe model requirements andstart_server.shfile on theAssembletab. This type of custom model can be paired with acustomordrop-inenvironment.

[Create a custom model](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-workshop/custom-inf-model.html)

### (Optional) Create a custom model environment

If you decide to use a custom environment or a custom drop-in environment, you must create that environment in the Custom Model Workshop. You can reuse any environments you create this way for other custom models.

You can assemble custom model environments in either of the following ways:

- Create a custom drop-in environmentwiththe model requirements andstart_server.shfile for the model.
- Create a custom environmentwithoutthe model requirements andstart_server.shfile. Instead, you must provide the requirements andstart_server.shfile in the model folder for the custom model you intend to use with this environment.

[Create a custom model environment](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-environments/custom-environments.html)

## Prepare the custom model

Before adding custom models and environments to DataRobot, you must prepare and structure the files required to run them successfully. The tools and templates necessary to prepare custom models are hosted in the [DataRobot User Models GitHub Repository](https://github.com/datarobot/datarobot-user-models) (Log in to GitHub before clicking this link.). Once you verify the model's files and folder structure, you can proceed to test the model.

[Prepare a custom model](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/index.html)

### (Optional) Test locally

The [DataRobot Model Runner](https://pypi.org/project/datarobot-drum/) is a tool you can use to work locally with Python, R, and Java custom models. It can verify that a custom model can run and make predictions before you add it to DataRobot. However, this testing is only for development purposes, and DataRobot recommends that you use the Custom Model Workshop to test any model you intend to deploy.

[Test a custom model locally](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-local-test.html)

### Test in DataRobot

Testing the custom model in the Custom Model Workshop ensures that the model is functional before deployment. These tests use the model environment to run the model and make predictions with test data.

> [!NOTE] Note
> While you can deploy your custom inference model without testing, DataRobot strongly recommends that you ensure your model passes testing in the Custom Model Workshop before deployment.

[Test a custom model in DataRobot](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-workshop/custom-model-test.html)

## Register the custom model

After successfully creating and testing a custom inference model in the Custom Model Workshop, you can add it to the Model Registry as a deployment-ready model package.

[Register a custom model](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-workshop/custom-model-reg.html)

## Deploy the custom model externally to a PPS

The custom model Portable Prediction Server (PPS) is a solution for deploying a custom model to an external prediction environment. The PPS is a downloadable tarball containing a deployed custom model, a custom model environment, and the MLOps monitoring agent. Once running, the PPS container serves predictions via the DataRobot API.

### (Optional) Add an external prediction environment

To create an MLOps custom model deployment compatible with the PPS bundle, you must add the custom model package to an external prediction environment. Create an external prediction environment if you don't already have one in DataRobot.

[Add an external prediction environment](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/ext-model-prep/ext-pred-env.html)

### Deploy the custom model package to an external prediction environment

To create an MLOps custom model deployment with an external prediction environment, deploy your custom model package to an external prediction environment.

[Deploy a custom model to an external prediction environment](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/deploy-methods/deploy-custom-inf-model.html)

### Deploy the custom model to a PPS

The custom model PPS bundle is provided for any custom model tagged as having an [external prediction environment](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/ext-model-prep/ext-pred-env.html) in the deployment inventory. You can download the custom model PPS bundle to deploy and monitor the custom model.

[Deploy a custom model to a PPS](https://docs.datarobot.com/en/docs/classic-ui/predictions/port-pred/pps/custom-pps.html)

---
