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
Learn how to deploy your machine learning or deep learning model as a web service in the Azure cloud.
18
20
19
-
> [!TIP]
20
-
> Managed online endpoints (preview) provide a way to deploy your trained model without your having to create and manage the underlying infrastructure. For more information, see [Deploy and score a machine learning model with a managed online endpoint (preview)](how-to-deploy-managed-online-endpoints.md).
@@ -28,26 +29,25 @@ The workflow is similar no matter where you deploy your model:
28
29
1. Prepare an inference configuration.
29
30
1. Deploy the model locally to ensure everything works.
30
31
1. Choose a compute target.
31
-
1.Re-deploy the model to the cloud.
32
+
1.Deploy the model to the cloud.
32
33
1. Test the resulting web service.
33
34
34
35
For more information on the concepts involved in the machine learning deployment workflow, see [Manage, deploy, and monitor models with Azure Machine Learning](concept-model-management-and-deployment.md).
- An Azure Machine Learning workspace. For more information, see [Create an Azure Machine Learning workspace](how-to-manage-workspace.md).
43
-
- A model. If you don't have a trained model, you can use the model and dependency files provided in [this tutorial](https://aka.ms/azml-deploy-cloud).
44
-
- The [Azure Command Line Interface (CLI) extension for the Machine Learning service](reference-azure-machine-learning-cli.md).
44
+
- A model. The examples in this article use a pre-trained model.
45
45
- A machine that can run Docker, such as a [compute instance](how-to-create-manage-compute-instance.md).
46
46
47
47
# [Python](#tab/python)
48
48
49
49
- An Azure Machine Learning workspace. For more information, see [Create an Azure Machine Learning workspace](how-to-manage-workspace.md).
50
-
- A model. If you don't have a trained model, you can use the model and dependency files provided in [this tutorial](https://aka.ms/azml-deploy-cloud).
50
+
- A model. The examples in this article use a pre-trained model.
51
51
- The [Azure Machine Learning software development kit (SDK) for Python](/python/api/overview/azure/ml/intro).
52
52
- A machine that can run Docker, such as a [compute instance](how-to-create-manage-compute-instance.md).
53
53
---
@@ -56,16 +56,14 @@ For more information on the concepts involved in the machine learning deployment
56
56
57
57
# [Azure CLI](#tab/azcli)
58
58
59
-
Do
59
+
To see the workspaces that you have access to, use the following commands:
60
60
61
61
```azurecli-interactive
62
62
az login
63
-
az account set -s <my subscription>
64
-
az ml workspace list --resource-group=<my resourcegroup>
63
+
az account set -s <subscription>
64
+
az ml workspace list --resource-group=<resource-group>
65
65
```
66
66
67
-
to see the workspaces you have access to.
68
-
69
67
# [Python](#tab/python)
70
68
71
69
```python
@@ -84,8 +82,8 @@ For more information on using the SDK to connect to a workspace, see the [Azure
84
82
85
83
A typical situation for a deployed machine learning service is that you need the following components:
86
84
87
-
+ resources representing the specific model that you want deployed (for example: a pytorch model file)
88
-
+ code that you will be running in the service, that executes the model on a given input
85
+
+ Resources representing the specific model that you want deployed (for example: a pytorch model file).
86
+
+ Code that you will be running in the service, that executes the model on a given input.
89
87
90
88
Azure Machine Learnings allows you to separate the deployment into two separate components, so that you can keep the same code, but merely update the model. We define the mechanism by which you upload a model _separately_ from your code as "registering the model".
91
89
@@ -97,33 +95,39 @@ The following examples demonstrate how to register a model.
97
95
98
96
# [Azure CLI](#tab/azcli)
99
97
100
-
### Register a model from a local file
98
+
The following commands download a model and then register it with your Azure Machine Learning workspace:
Set `-p` to the path of a folder or a file that you want to register.
105
109
106
-
For more information on `az ml model register`, consult the [reference documentation](/cli/azure/ext/azure-cli-ml/ml/model).
110
+
For more information on `az ml model register`, see the [reference documentation](/cli/azure/ml(v1)/model).
107
111
108
112
### Register a model from an Azure ML training run
109
113
114
+
If you need to register a model that was created previously through an Azure Machine Learning training job, you can specify the experiment, run, and path to the model:
115
+
110
116
```azurecli-interactive
111
117
az ml model register -n bidaf_onnx --asset-path outputs/model.onnx --experiment-name myexperiment --run-id myrunid --tag area=qna
The `--asset-path` parameter refers to the cloud location of the model. In this example, the path of a single file is used. To include multiple files in the model registration, set `--asset-path` to the path of a folder that contains the files.
117
121
118
-
For more information on `az ml model register`, consult the [reference documentation](/cli/azure/ml/model).
122
+
For more information on `az ml model register`, see the [reference documentation](/cli/azure/ml(v1)/model).
119
123
120
124
# [Python](#tab/python)
121
125
122
126
### Register a model from a local file
123
127
124
128
You can register a model by providing the local path of the model. You can provide the path of either a folder or a single file on your local machine.
For more information on environments, see [Create and manage environments for training and deployment](how-to-use-environments.md).
201
205
@@ -206,43 +210,69 @@ For more information on inference configuration, see the [InferenceConfig](/pyth
206
210
207
211
## Define a deployment configuration
208
212
209
-
A deployment configuration specifies the amount of memory and cores to reserve foryour webservice will require in order to run, as well as configuration details of the underlying webservice. For example, a deployment configuration lets you specify that your service needs 2 gigabytes of memory, 2CPU cores, 1GPU core, and that you want to enable autoscaling.
213
+
A deployment configuration specifies the amount of memory and cores your webservice needs in order to run. It also provides configuration details of the underlying webservice. For example, a deployment configuration lets you specify that your service needs 2 gigabytes of memory, 2CPU cores, 1GPU core, and that you want to enable autoscaling.
210
214
211
215
The options available for a deployment configuration differ depending on the compute target you choose. In a local deployment, all you can specify is which port your webservice will be served on.
For more information, see the documentation for [Model.deploy()](/python/api/azureml-core/azureml.core.model.model#deploy-workspace--name--models--inference-config-none--deployment-config-none--deployment-target-none--overwrite-false-) and [Webservice](/python/api/azureml-core/azureml.core.webservice.webservice).
257
+
258
+
---
233
259
234
260
## Call into your model
235
261
236
262
Let's check that your echo model deployed successfully. You should be able to do a simple liveness request, as well as a scoring request:
For more information, see the documentation for [Model.deploy()](/python/api/azureml-core/azureml.core.model.model#deploy-workspace--name--models--inference-config-none--deployment-config-none--deployment-target-none--overwrite-false-) and [Webservice](/python/api/azureml-core/azureml.core.webservice.webservice).
300
336
@@ -303,23 +339,23 @@ Then ensure you can send a post request to the service:
Refer to the below diagram when choosing a compute target.
317
-
318
-
[](././media/how-to-deploy-and-where/how-to-choose-target.png#lightbox)
For more information, see the documentation for [Model.deploy()](/python/api/azureml-core/azureml.core.model.model#deploy-workspace--name--models--inference-config-none--deployment-config-none--deployment-target-none--overwrite-false-) and [Webservice](/python/api/azureml-core/azureml.core.webservice.webservice).
363
413
@@ -368,9 +418,9 @@ For more information, see the documentation for [Model.deploy()](/python/api/azu
368
418
369
419
When you deploy remotely, you may have key authentication enabled. The example below shows how to get your service key with Python in order to make an inference request.
0 commit comments