@@ -58,7 +58,7 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
58
58
59
59
# [ Azure CLI] ( #tab/cli )
60
60
61
- ``` bash
61
+ ``` azurecli
62
62
az account set --subscription <subscription>
63
63
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
64
64
```
@@ -91,7 +91,7 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
91
91
92
92
# [ Azure CLI] ( #tab/cli )
93
93
94
- ``` bash
94
+ ``` azurecli
95
95
MODEL_NAME='heart-classifier'
96
96
az ml model create --name $MODEL_NAME --type "mlflow_model" --path "heart-classifier-mlflow/model"
97
97
```
@@ -126,7 +126,7 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
126
126
127
127
Create the compute using the following command:
128
128
129
- ` ` ` bash
129
+ ` ` ` azurecli
130
130
az ml compute create -f cpu-cluster.yml
131
131
```
132
132
@@ -156,9 +156,9 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
156
156
157
157
Then, create the endpoint with the following command:
158
158
159
- ` ` ` bash
159
+ ` ` ` azurecli
160
160
ENDPOINT_NAME='heart-classifier-batch'
161
- az ml batch-endpoint create -f endpoint.yml
161
+ az ml batch-endpoint create -n $ENDPOINT_NAME - f endpoint.yml
162
162
```
163
163
164
164
# [ Python] ( #tab/sdk )
@@ -170,6 +170,11 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
170
170
name = " heart-classifier-batch" ,
171
171
description = " A heart condition classifier for batch inference" ,
172
172
)
173
+ ```
174
+
175
+ Then, create the endpoint with the following command:
176
+
177
+ ``` python
173
178
ml_client.batch_endpoints.begin_create_or_update(endpoint)
174
179
```
175
180
@@ -201,14 +206,14 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
201
206
202
207
Then, create the deployment with the following command:
203
208
204
- ` ` ` bash
209
+ ` ` ` azurecli
205
210
DEPLOYMENT_NAME="classifier-xgboost-mlflow"
206
- az ml batch-deployment create -f endpoint.yml
211
+ az ml batch-deployment create -n $DEPLOYMENT_NAME - f endpoint.yml
207
212
```
208
213
209
214
# [ Python] ( #tab/sdk )
210
215
211
- To create a new deployment under the created endpoint, use the following script :
216
+ To create a new deployment under the created endpoint, first define the deployment :
212
217
213
218
``` python
214
219
deployment = BatchDeployment(
@@ -225,6 +230,11 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
225
230
retry_settings = BatchRetrySettings(max_retries = 3 , timeout = 300 ),
226
231
logging_level = " info" ,
227
232
)
233
+ ```
234
+
235
+ Then, create the deployment with the following command:
236
+
237
+ ``` python
228
238
ml_client.batch_deployments.begin_create_or_update(deployment)
229
239
```
230
240
---
@@ -236,13 +246,14 @@ Follow these steps to deploy an MLflow model to a batch endpoint for running bat
236
246
237
247
# [ Azure CLI] ( #tab/cli )
238
248
239
- ``` bash
249
+ ``` azurecli
240
250
az ml batch-endpoint update --name $ENDPOINT_NAME --set defaults.deployment_name=$DEPLOYMENT_NAME
241
251
```
242
252
243
253
# [ Python] ( #tab/sdk )
244
254
245
255
``` python
256
+ endpoint = ml_client.batch_endpoints.get(endpoint.name)
246
257
endpoint.defaults.deployment_name = deployment.name
247
258
ml_client.batch_endpoints.begin_create_or_update(endpoint)
248
259
```
@@ -257,7 +268,7 @@ For testing our endpoint, we are going to use a sample of unlabeled data located
257
268
258
269
# [ Azure CLI] ( #tab/cli )
259
270
260
- Create a data asset definition in ` YAML ` :
271
+ a. Create a data asset definition in ` YAML ` :
261
272
262
273
__ heart-dataset-unlabeled.yml__
263
274
``` yaml
@@ -268,14 +279,16 @@ For testing our endpoint, we are going to use a sample of unlabeled data located
268
279
path : heart-classifier-mlflow/data
269
280
` ` `
270
281
271
- Then, create the data asset:
282
+ b. Create the data asset:
272
283
273
- ` ` ` bash
284
+ ` ` ` azurecli
274
285
az ml data create -f heart-dataset-unlabeled.yml
275
286
```
276
287
277
288
# [ Python] ( #tab/sdk )
278
289
290
+ a. Create a data asset definition:
291
+
279
292
``` python
280
293
data_path = " heart-classifier-mlflow/data"
281
294
dataset_name = " heart-dataset-unlabeled"
@@ -286,14 +299,25 @@ For testing our endpoint, we are going to use a sample of unlabeled data located
286
299
description = " An unlabeled dataset for heart classification" ,
287
300
name = dataset_name,
288
301
)
302
+ ```
303
+
304
+ b. Create the data asset:
305
+
306
+ ``` python
289
307
ml_client.data.create_or_update(heart_dataset_unlabeled)
290
308
```
291
309
310
+ c. Refresh the object to reflect the changes:
311
+
312
+ ``` python
313
+ heart_dataset_unlabeled = ml_client.data.get(name = dataset_name)
314
+ ```
315
+
292
316
2 . Now that the data is uploaded and ready to be used, let's invoke the endpoint:
293
317
294
318
# [ Azure CLI] ( #tab/cli )
295
319
296
- ``` bash
320
+ ``` azurecli
297
321
JOB_NAME = $(az ml batch-endpoint invoke --name $ENDPOINT_NAME --input azureml:heart-dataset-unlabeled@latest | jq -r '.name')
298
322
```
299
323
@@ -318,7 +342,7 @@ For testing our endpoint, we are going to use a sample of unlabeled data located
318
342
319
343
# [ Azure CLI] ( #tab/cli )
320
344
321
- ``` bash
345
+ ``` azurecli
322
346
az ml job show --name $JOB_NAME
323
347
```
324
348
@@ -346,7 +370,7 @@ You can download the results of the job by using the job name:
346
370
347
371
To download the predictions, use the following command:
348
372
349
- ``` bash
373
+ ``` azurecli
350
374
az ml job download --name $JOB_NAME --output-name score --download-path ./
351
375
```
352
376
@@ -535,7 +559,7 @@ Use the following steps to deploy an MLflow model with a custom scoring script.
535
559
536
560
Then, create the deployment with the following command:
537
561
538
- ` ` ` bash
562
+ ` ` ` azurecli
539
563
az ml batch-deployment create -f deployment.yml
540
564
```
541
565
0 commit comments