Skip to main content
Version: 1.40

Create and update Deployments

Preparation

In order to deploy models, you need a Personal Key Pair. For more information regarding authentication, see Authentication.

Another part of the preparation is getting familiar with the repository contract that Deeploy uses, you can find more information about that here. If your model is stored elsewhere and you do not yet adhere to the contract, you generate a reference.json.

Default

If you are not using a SageMaker integration or Azure Machine Learning integration, you can use our default Deployment methods.

Create a Deployment

See all Create Deployment arguments

from deeploy import CreateDeployment
from deeploy.enums import ModelType

create_options: CreateDeployment = {
"name": "Python Client",
"description": "Python Client Description",
"repository_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
"branch_name": "master",
"commit": "b26af7790c1d3b27b953b37806b91cb6735c590b",
"model_type": ModelType.CUSTOM,
"model_serverless": True,
}

deployment = client.create_deployment(create_options)

Update a Deployment

See all Update Deployment arguments

from deeploy import UpdateDeployment

update_options: UpdateDeployment = {
"model_mem_request": 256,
"model_mem_limit": 256,
"model_cpu_request": 0.1,
"model_cpu_limit": 0.5,
}

updated_deployment = client.update_deployment(deployment_id, update_options)

SageMaker

Create a SageMaker Deployment

See all Create SageMaker Deployment arguments

from deeploy import CreateSageMakerDeployment
from deeploy.enums import ModelType

create_options: CreateSageMakerDeployment = {
"name": "Python Client",
"description": "Python Client Description",
"repository_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
"branch_name": "master",
"commit": "b26af7790c1d3b27b953b37806b91cb6735c590b",
"model_type": ModelType.CUSTOM,
"model_instance_type": 'ml.c5.large',
}

deployment = client.create_sagemaker_deployment(create_options)

Update a SageMaker Deployment

See all Update SageMaker Deployment arguments

from deeploy import UpdateSageMakerDeployment

update_options: UpdateSageMakerDeployment = {
"model_instance_type": 'ml.c4.large',
}

updated_deployment = client.update_sagemaker_deployment(deployment_id, update_options)

Azure Machine Learning

Create an Azure Machine Learning Deployment

See all Create Azure Machine Learning Deployment arguments

from deeploy import CreateAzureMLDeployment
from deeploy.enums import ExplainerType, ModelType

create_options: CreateAzureMLDeployment = {
"name": "Python Client",
"description": "Python Client Description",
"repository_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
"branch_name": "main",
"commit": "ea420035f347fad091e367a9ce2798aef6cae9eb",
"model_type": ModelType.CUSTOM,
"explainer_type": ExplainerType.CUSTOM,
"model_instance_type": "Standard_D2as_v4",
"model_instance_count": 1,
"explainer_instance_type": "Standard_D2as_v4",
"explainer_instance_count": 1,
}

azure_ml_deployment = client.create_azure_ml_deployment(create_options)

Update an Azure Machine Learning Deployment

See all Update Azure Machine Learning Deployment arguments

from deeploy import UpdateAzureMLDeployment

update_options: UpdateAzureMLDeployment = {
"model_instance_type": "Standard_D2as_v4",
"model_instance_count": 1,
"explainer_instance_type": "Standard_D2as_v4",
"explainer_instance_count": 1,
}

updated_azure_ml_deployment = client.update_azure_ml_deployment(deployment_id, update_options)

General

Update the Deployment description

from deeploy import UpdateDeploymentDescription

description_options: UpdateDeploymentDescription = {
"name": "Python Client v2",
"description": "Python Client Description v2",
}

updated_deployment = client.update_deployment_description(deployment_id, description_options)

Creating multiple Deployments from a monorepo

Deeploy supports creating multiple Deployments from the same repository using a contract path. The contract path is the path relative to the root of a repository where the deeploy contract for a Deployment is located. The idea is that you create your Deeploy contract path at a subfolder in the repository, as shown in the example below.

repository

├─ subfolder_1
│ ├─ model
│ │ └─ reference.json
│ ├─ explainer
│ │ └─ reference.json
│ ├─ transformer
│ │ └─ reference.json
│ └─ metadata.json

└─ subfolder_2
└─ model
└─ reference.json

To create a Deployment from a contract path, you provide the relative path from the repository root as input to the Python SDK or Core API. In the example above this is subfolder_1 or subfolder_2.

from deeploy import CreateDeployment

create_options: CreateDeployment = {
# other options
"contract_path": "/subfolder_1",
}

deployment = client.create_deployment(create_options)

Check out the API reference for more information.