You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/service/how-to-deploy-and-where.md
+69-68Lines changed: 69 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,45 +43,45 @@ For more information on the concepts involved in the deployment workflow, see [M
43
43
44
44
- The [Azure CLI extension for Machine Learning service](reference-azure-machine-learning-cli.md), or the [Azure Machine Learning Python SDK](https://aka.ms/aml-sdk).
45
45
46
-
## <aid="registermodel"></a> Register ML models
46
+
## <aid="registermodel"></a> Register your model
47
47
48
48
Register your machine learning models in your Azure Machine Learning workspace. The model can come from Azure Machine Learning or can come from somewhere else. The following examples demonstrate how to register a model from file:
49
49
50
50
### Register a model from an Experiment Run
51
51
52
-
**Scikit-Learn example with the CLI**
53
-
```azurecli-interactive
54
-
az ml model register -n sklearn_mnist --asset-path outputs/sklearn_mnist_model.pkl --experiment-name myexperiment
55
-
```
56
-
**Using the SDK**
57
-
```python
58
-
model = run.register_model(model_name='sklearn_mnist', model_path='outputs/sklearn_mnist_model.pkl')
description="MNIST image classification CNN from ONNX Model Zoo",)
79
+
```
80
+
81
+
+**Using the CLI**
82
+
```azurecli-interactive
83
+
az ml model register -n onnx_mnist -p mnist/model.onnx
84
+
```
85
85
86
86
**Time estimate**: Approximately 10 seconds.
87
87
@@ -218,79 +218,80 @@ The following sections demonstrate how to create the deployment configuration, a
218
218
219
219
## Deploy to target
220
220
221
-
### <aid="local"></a> Deploy locally
221
+
### <aid="local"></a> Local deployment
222
+
223
+
To deploy locally, you need to have **Docker installed** on your local machine.
222
224
223
225
The examples in this section use [deploy_from_image](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py#deploy-from-model-workspace--name--models--image-config--deployment-config-none--deployment-target-none-), which requires you to register the model and image before doing a deployment. For more information on other deployment methods, see [deploy](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py#deploy-workspace--name--model-paths--image-config--deployment-config-none--deployment-target-none-) and [deploy_from_model](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py#deploy-from-model-workspace--name--models--image-config--deployment-config-none--deployment-target-none-).
224
226
225
-
**To deploy locally, you need to have Docker installed on your local machine.**
Use Azure Container Instances for deploying your models as a web service if one or more of the following conditions is true:
245
246
- You need to quickly deploy and validate your model.
246
247
- You are testing a model that is under development.
247
248
248
249
To see quota and region availability for ACI, see the [Quotas and region availability for Azure Container Instances](https://docs.microsoft.com/azure/container-instances/container-instances-quotas) article.
service = Model.deploy(ws, "aciservice", [model], inference_config, deployment_config)
256
+
service.wait_for_deployment(show_output=True)
257
+
print(service.state)
258
+
```
258
259
259
-
**Using the CLI**
260
+
+**Using the CLI**
260
261
261
-
```azurecli-interactive
262
-
az ml model deploy -m sklearn_mnist:1 -n aciservice -ic inferenceconfig.json -dc deploymentconfig.json
263
-
```
262
+
```azurecli-interactive
263
+
az ml model deploy -m sklearn_mnist:1 -n aciservice -ic inferenceconfig.json -dc deploymentconfig.json
264
+
```
264
265
265
266
For more information, see the reference documentation for the [AciWebservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.aciwebservice?view=azure-ml-py) and [Webservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.webservice?view=azure-ml-py) classes.
266
267
267
-
### <aid="aks"></a> Deploy to Azure Kubernetes Service (PRODUCTION)
268
+
### <aid="aks"></a>Azure Kubernetes Service (PRODUCTION)
268
269
269
270
You can use an existing AKS cluster or create a new one using the Azure Machine Learning SDK, CLI, or the Azure portal.
270
271
271
272
<aid="deploy-aks"></a>
272
273
273
-
If you already have an AKS cluster attached, you can deploy to it. If you have NOT created or attached an AKS cluster go <ahref="#create-attach-aks">here</a>.
274
+
If you already have an AKS cluster attached, you can deploy to it. If you haven't created or attached an AKS cluster, follow the process to <ahref="#create-attach-aks">create a new AKS cluster</a>.
service = Model.deploy(ws, "aksservice", [model], inference_config, deployment_config, aks_target)
283
+
service.wait_for_deployment(show_output=True)
284
+
print(service.state)
285
+
print(service.get_logs())
286
+
```
286
287
287
-
Learn more about AKS deployment and autoscale in the [AksWebservice.deploy_configuration](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.akswebservice) reference.
288
+
Learn more about AKS deployment and autoscale in the [AksWebservice.deploy_configuration](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.akswebservice) reference.
288
289
289
-
**Using the CLI**
290
+
+**Using the CLI**
290
291
291
-
```azurecli-interactive
292
-
az ml model deploy -ct myaks -m mymodel:1 -n aksservice -ic inferenceconfig.json -dc deploymentconfig.json
293
-
```
292
+
```azurecli-interactive
293
+
az ml model deploy -ct myaks -m mymodel:1 -n aksservice -ic inferenceconfig.json -dc deploymentconfig.json
294
+
```
294
295
295
296
#### Create a new AKS cluster<aid="create-attach-aks"></a>
0 commit comments