The Model Deployment
azure_helper.steps.deploy_aml_model
DeploymentSettings
Bases: BaseModel
Basic settings needed for the deployment, whether it is with ACI or AKS.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment_service_name |
str
|
the name of the service you want to deploy or update. |
required |
cpu_cores |
int
|
The number of cpu cores needed. Defaults to 1. |
required |
gpu_cores |
int
|
The number of gpu cores needed. Defaults to 0. |
required |
memory_gb |
int
|
The memory in gb needed. Defaults to 1. |
required |
enable_app_insights |
bool
|
Enable app insights monitoring. Defaults to True. |
required |
Source code in azure_helper/steps/deploy_aml_model.py
DeployModel
Source code in azure_helper/steps/deploy_aml_model.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
__init__(aml_interface, aml_env_name, model_name, script_config_path, deployment_settings)
Instantiate the deployment of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
aml_interface |
AMLInterface
|
The AMLInterface which will be responsible to deploy the model. |
required |
aml_env_name |
str
|
The name of the AMLEnvironment you will use to deploy the model. It is not necessarily the same used to train the model. |
required |
model_name |
str
|
The name of the model you deploy. |
required |
script_config_path |
Path
|
The location of the inference script. |
required |
deployment_settings |
DeploymentSettings
|
the basic settings of the deployment. |
required |
Source code in azure_helper/steps/deploy_aml_model.py
get_inference_config()
Fetch the inference script config needed to interact the endpoint deployed.
Returns:
Name | Type | Description |
---|---|---|
InferenceConfig |
InferenceConfig
|
The instantiated inference config. |
Source code in azure_helper/steps/deploy_aml_model.py
deploy_aciservice(*args, **kwargs)
Deploy an ACI service to serve the model.
Source code in azure_helper/steps/deploy_aml_model.py
deploy_aksservice(aks_cluster_name, *args, **kwargs)
Deploy an AKS service to serve the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
script_config_path |
Path
|
The location of the script for the inference config. |
required |
aks_cluster_name |
str
|
The name of the k8s cluster on which you want to deploy. Contrary to an ACI deployment, you need a pre-existing k8s cluster in your workspace to use AKS deployment. |
required |
Source code in azure_helper/steps/deploy_aml_model.py
update_service()
Update an already existing service, ACI or AKS.
Source code in azure_helper/steps/deploy_aml_model.py
Deploy to AKS
When deploying to Azure Kubernetes Service, key-based authentication is enabled by default. You can also enable token-based authentication. Token-based authentication requires clients to use an Azure Active Directory account to request an authentication token, which is used to make requests to the deployed service.
Limitations
- Using a service principal with AKS is not supported by Azure Machine Learning. The AKS cluster must use a system-assigned managed identity instead.
Tutorial
Prepare an application for Azure Kubernetes Service (AKS)
Create a Kubernetes cluster
Install kubectl
Connect to cluster using kubectl
Update the manifest file
In these tutorials, an Azure Container Registry (ACR) instance stores the container image for the sample application. To deploy the application, you must update the image name in the Kubernetes manifest file to include the ACR login server name.
Deploy the application
To deploy your application, use the kubectl apply command.