Skip to content

Commit dacd150

Browse files
Merge pull request #239414 from santiagxf/santiagxf/azureml-batch-syntax
Update reference-yaml-deployment-batch.md
2 parents 05ba6e5 + 6dd5750 commit dacd150

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

articles/machine-learning/reference-yaml-deployment-batch.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ ms.date: 03/31/2022
1919

2020
The source JSON schema can be found at https://azuremlschemas.azureedge.net/latest/batchDeployment.schema.json.
2121

22-
23-
2422
[!INCLUDE [schema note](../../includes/machine-learning-preview-old-json-schema-note.md)]
2523

2624
## YAML syntax
@@ -32,40 +30,66 @@ The source JSON schema can be found at https://azuremlschemas.azureedge.net/late
3230
| `description` | string | Description of the deployment. | | |
3331
| `tags` | object | Dictionary of tags for the deployment. | | |
3432
| `endpoint_name` | string | **Required.** Name of the endpoint to create the deployment under. | | |
35-
| `model` | string or object | **Required.** The model to use for the deployment. This value can be either a reference to an existing versioned model in the workspace or an inline model specification. <br><br> To reference an existing model, use the `azureml:<model-name>:<model-version>` syntax. <br><br> To define a model inline, follow the [Model schema](reference-yaml-model.md#yaml-syntax). <br><br> As a best practice for production scenarios, you should create the model separately and reference it here. | | |
33+
| `type` | string | **Required.** Type of the bath deployment. Use `model` for [model deployments](concept-endpoints-batch.md#model-deployments) and `pipeline` for [pipeline component deployments](concept-endpoints-batch.md#pipeline-component-deployment-preview). Introduced since version 1.7. | `model`, `pipeline` | `model` |
34+
| `settings` | object | **Required if type is indicated.** Specific configuration of the deployment. See specific YAML reference for model and pipeline component for allowed values. Introduced since version 1.7. | | |
35+
36+
> [!TIP]
37+
> The key `type` has been introduced in version 1.7 of the CLI extension and above. To fully support backward compatibility, this property defaults to `model`. However, if not explicitly indicated, the key `settings` is not enforced and all the properties for the model deployment settings should be indicated in to root of the YAML specification.
38+
39+
### YAML syntax for model deployments
40+
41+
When `type: model`, the following syntax is enforced:
42+
43+
| Key | Type | Description | Allowed values | Default value |
44+
| --- | ---- | ----------- | -------------- | ------------- |
45+
| `model` | string or object | **Required.** The model to use for the deployment. This value can be either a reference to an existing versioned model in the workspace or an inline model specification. <br><br> To reference an existing model, use the `azureml:<model-name>:<version>` syntax. <br><br> To define a model inline, follow the [Model schema](reference-yaml-model.md#yaml-syntax). <br><br> As a best practice for production scenarios, you should create the model separately and reference it here. | | |
3646
| `code_configuration` | object | Configuration for the scoring code logic. <br><br> This property is not required if your model is in MLflow format. | | |
3747
| `code_configuration.code` | string | The local directory that contains all the Python source code to score the model. | | |
38-
| `code_configuration.scoring_script` | string | The Python file in the above directory. This file must have an `init()` function and a `run()` function. Use the `init()` function for any costly or common preparation (for example, load the model in memory). `init()` will be called only once at beginning of process. Use `run(mini_batch)` to score each entry; the value of `mini_batch` is a list of file paths. The `run()` function should return a pandas DataFrame or an array. Each returned element indicates one successful run of input element in the `mini_batch`. For more information on how to author scoring script, see [Understanding the scoring script](batch-inference/how-to-batch-scoring-script.md#understanding-the-scoring-script).| | |
48+
| `code_configuration.scoring_script` | string | The Python file in the above directory. This file must have an `init()` function and a `run()` function. Use the `init()` function for any costly or common preparation (for example, load the model in memory). `init()` is called only once at beginning of process. Use `run(mini_batch)` to score each entry; the value of `mini_batch` is a list of file paths. The `run()` function should return a pandas DataFrame or an array. Each returned element indicates one successful run of input element in the `mini_batch`. For more information on how to author scoring script, see [Understanding the scoring script](batch-inference/how-to-batch-scoring-script.md#understanding-the-scoring-script).| | |
3949
| `environment` | string or object | The environment to use for the deployment. This value can be either a reference to an existing versioned environment in the workspace or an inline environment specification. <br><br> This property is not required if your model is in MLflow format. <br><br> To reference an existing environment, use the `azureml:<environment-name>:<environment-version>` syntax. <br><br> To define an environment inline, follow the [Environment schema](reference-yaml-environment.md#yaml-syntax). <br><br> As a best practice for production scenarios, you should create the environment separately and reference it here. | | |
4050
| `compute` | string | **Required.** Name of the compute target to execute the batch scoring jobs on. This value should be a reference to an existing compute in the workspace using the `azureml:<compute-name>` syntax. | | |
4151
| `resources.instance_count` | integer | The number of nodes to use for each batch scoring job. | | `1` |
42-
| `max_concurrency_per_instance` | integer | The maximum number of parallel `scoring_script` runs per instance. | | `1` |
43-
| `error_threshold` | integer | The number of file failures that should be ignored. If the error count for the entire input goes above this value, the batch scoring job will be terminated. `error_threshold` is for the entire input and not for individual mini batches. If omitted, any number of file failures will be allowed without terminating the job. | | `-1` |
44-
| `logging_level` | string | The log verbosity level. | `warning`, `info`, `debug` | `info` |
45-
| `mini_batch_size` | integer | The number of files the `code_configuration.scoring_script` can process in one `run()` call. | | `10` |
46-
| `retry_settings` | object | Retry settings for scoring each mini batch. | | |
47-
| `retry_settings.max_retries` | integer | The maximum number of retries for a failed or timed-out mini batch. | | `3` |
48-
| `retry_settings.timeout` | integer | The timeout in seconds for scoring a mini batch. | | `30` |
49-
| `output_action` | string | Indicates how the output should be organized in the output file. | `append_row`, `summary_only` | `append_row` |
50-
| `output_file_name` | string | Name of the batch scoring output file. | | `predictions.csv` |
52+
| `settings.max_concurrency_per_instance` | integer | The maximum number of parallel `scoring_script` runs per instance. | | `1` |
53+
| `settings.error_threshold` | integer | The number of file failures that should be ignored. If the error count for the entire input goes above this value, the batch scoring job is terminated. `error_threshold` is for the entire input and not for individual mini batches. If omitted, any number of file failures is allowed without terminating the job. | | `-1` |
54+
| `settings.logging_level` | string | The log verbosity level. | `warning`, `info`, `debug` | `info` |
55+
| `settings.mini_batch_size` | integer | The number of files the `code_configuration.scoring_script` can process in one `run()` call. | | `10` |
56+
| `settings.retry_settings` | object | Retry settings for scoring each mini batch. | | |
57+
| `settings.retry_settings.max_retries` | integer | The maximum number of retries for a failed or timed-out mini batch. | | `3` |
58+
| `settings.retry_settings.timeout` | integer | The timeout in seconds for scoring a single mini batch. Use larger values when the mini-batch size is bigger or the model is more expensive to run. | | `30` |
59+
| `settings.output_action` | string | Indicates how the output should be organized in the output file. Use `summary_only` if you are generating the output files as indicated at [Customize outputs in model deployments](how-to-deploy-model-custom-output.md). Use `append_row` if you are returning predictions as part of the `run()` function `return` statement. | `append_row`, `summary_only` | `append_row` |
60+
| `settings.output_file_name` | string | Name of the batch scoring output file. | | `predictions.csv` |
5161
| `environment_variables` | object | Dictionary of environment variable key-value pairs to set for each batch scoring job. | | |
5262

63+
### YAML syntax for pipeline component deployments
64+
65+
When `type: pipeline`, the following syntax is enforced:
66+
67+
| Key | Type | Description | Allowed values | Default value |
68+
| --- | ---- | ----------- | -------------- | ------------- |
69+
| `component` | string or object | **Required.** The pipeline component used for the deployment. This value can be either a reference to an existing versioned pipeline component in the workspace or in a registry, or an inline pipeline specification. <br><br> To reference an existing component, use the `azureml:<component-name>:<version>` syntax. <br><br> To define a pipeline component inline, follow the [Pipeline component schema](reference-yaml-component-pipeline.md#yaml-syntax). <br><br> As a best practice for production scenarios, you should create the component separately and reference it here. | | |
70+
| `settings.default_storage_account` | string | Name of the default storage account for intermediate inputs and outputs in the pipeline. | | |
71+
| `settings.default_compute` | string | Name of the default compute to use for the pipeline. | | |
72+
5373
## Remarks
5474

5575
The `az ml batch-deployment` commands can be used for managing Azure Machine Learning batch deployments.
5676

5777
## Examples
5878

59-
Examples are available in the [examples GitHub repository](https://github.com/Azure/azureml-examples/tree/main/cli/endpoints/batch). Several are shown below.
79+
Examples are available in the [examples GitHub repository](https://github.com/Azure/azureml-examples/tree/main/cli/endpoints/batch).
6080

61-
## YAML: basic (MLflow)
81+
## YAML: MLflow model deployment
6282

6383
:::code language="yaml" source="~/azureml-examples-main/cli/endpoints/batch/deploy-models/heart-classifier-mlflow/deployment-simple/deployment.yml":::
6484

65-
## YAML: custom model and scoring code
85+
## YAML: Custom model deployment with scoring script
6686

6787
:::code language="yaml" source="~/azureml-examples-main/cli/endpoints/batch/deploy-models/mnist-classifier/deployment-torch/deployment.yml":::
6888

89+
## YAML: Pipeline component deployment
90+
91+
:::code language="yaml" source="~/azureml-examples-main/cli/endpoints/batch/deploy-pipelines/hello-batch/deployment.yml":::
92+
6993
## Next steps
7094

7195
- [Install and use the CLI (v2)](how-to-configure-cli.md)

0 commit comments

Comments
 (0)