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
This article will show you how to share a machine learning pipeline with your colleagues or customers.
24
+
This article describes how to share a machine learning pipeline with your colleagues or customers.
23
25
24
-
Machine learning pipelines are reusable workflows for machine learning tasks. One benefit of pipelines is increased collaboration. You can also version pipelines, allowing customers to use the current model while you're working on a new version.
26
+
Machine learning pipelines are reusable workflows for machine learning tasks. One benefit of pipelines is increased collaboration. You can also version pipelines to enable customers to use the current model while you're working on a new version.
25
27
26
28
## Prerequisites
27
29
28
-
* Create an [Azure Machine Learning workspace](../quickstart-create-resources.md) to hold all your pipeline resources
30
+
* Create an [Azure Machine Learning workspace](../quickstart-create-resources.md) to contain your pipeline resources.
29
31
30
-
*[Configure your development environment](how-to-configure-environment.md)to install the Azure Machine Learning SDK, or use an [Azure Machine Learning compute instance](../concept-compute-instance.md)with the SDK already installed
32
+
*[Configure your development environment](how-to-configure-environment.md)by installing the Azure Machine Learning SDK, or use an [Azure Machine Learning compute instance](../concept-compute-instance.md)that already has the SDK installed.
31
33
32
-
* Create and run a machine learning pipeline, such as by following [Tutorial: Build an Azure Machine Learning pipeline for batch scoring](../tutorial-pipeline-batch-scoring-classification.md). For other options, see [Create and run machine learning pipelines with Azure Machine Learning SDK](./how-to-create-machine-learning-pipelines.md)
34
+
* Create and run a machine learning pipeline. One way to meet this requirement is to complete [Tutorial: Build an Azure Machine Learning pipeline for batch scoring](../tutorial-pipeline-batch-scoring-classification.md). For other options, see [Create and run machine learning pipelines with Azure Machine Learning SDK](./how-to-create-machine-learning-pipelines.md).
33
35
34
36
## Publish a pipeline
35
37
36
-
Once you have a pipeline up and running, you can publish a pipeline so that it runs with different inputs. For the REST endpoint of an already published pipeline to accept parameters, you must configure your pipeline to use `PipelineParameter` objects for the arguments that will vary.
38
+
After you have a running pipeline, you can publish it so that it runs with different inputs. For the REST endpoint of a published pipeline to accept parameters, you must configure your pipeline to use `PipelineParameter` objects for the arguments that will vary.
37
39
38
-
1. To create a pipeline parameter, use a [PipelineParameter](/python/api/azureml-pipeline-core/azureml.pipeline.core.graph.pipelineparameter) object with a default value.
40
+
1. To create a pipeline parameter, use a [PipelineParameter](/python/api/azureml-pipeline-core/azureml.pipeline.core.graph.pipelineparameter) object with a default value:
39
41
40
42
```python
41
43
from azureml.pipeline.core.graph import PipelineParameter
@@ -45,7 +47,7 @@ Once you have a pipeline up and running, you can publish a pipeline so that it r
45
47
default_value=10)
46
48
```
47
49
48
-
2. Add this`PipelineParameter` object as a parameter to any of the steps in the pipeline as follows:
50
+
1. Add the`PipelineParameter` object as a parameter to any of the steps in the pipeline, as shown here:
49
51
50
52
```python
51
53
compareStep = PythonScriptStep(
@@ -57,7 +59,7 @@ Once you have a pipeline up and running, you can publish a pipeline so that it r
57
59
source_directory=project_folder)
58
60
```
59
61
60
-
3. Publish this pipeline that will accept a parameter when invoked.
62
+
1. Publish this pipeline, which will accept a parameter when invoked:
@@ -66,18 +68,18 @@ Once you have a pipeline up and running, you can publish a pipeline so that it r
66
68
version="1.0")
67
69
```
68
70
69
-
4. After you publish your pipeline, you can check it in the UI. Pipeline ID is the unique identified of the published pipeline.
71
+
1. After you publish your pipeline, you can check it in the UI. **Pipeline ID** is the unique identifier of the published pipeline.
70
72
71
-
:::image type="content" source="./media/how-to-deploy-pipelines/published-pipeline-detail.png" alt-text="Screenshot showing published pipeline detail." lightbox= "./media/how-to-deploy-pipelines/published-pipeline-detail.png":::
73
+
:::image type="content" source="./media/how-to-deploy-pipelines/published-pipeline-detail.png" alt-text="Screenshot showing details of the published pipeline." lightbox= "./media/how-to-deploy-pipelines/published-pipeline-detail.png":::
72
74
73
75
## Run a published pipeline
74
76
75
-
All published pipelines have a REST endpoint. With the pipeline endpoint, you can trigger a run of the pipeline from any external systems, including non-Python clients. This endpoint enables "managed repeatability" in batch scoring and retraining scenarios.
77
+
All published pipelines have a REST endpoint. By using the pipeline endpoint, you can trigger a run of the pipeline from external systems, including non-Python clients. This endpoint enables managed repeatability in batch scoring and retraining scenarios.
76
78
77
79
> [!IMPORTANT]
78
-
> If you are using Azure role-based access control (Azure RBAC) to manage access to your pipeline, [set the permissions for your pipeline scenario (training or scoring)](../how-to-assign-roles.md#common-scenarios).
80
+
> If you use Azure role-based access control (RBAC) to manage access to your pipeline, [set the permissions for your pipeline scenario (training or scoring)](../how-to-assign-roles.md#common-scenarios).
79
81
80
-
To invoke the run of the preceding pipeline, you need a Microsoft Entra authentication header token. Getting such a token is described in the [AzureCliAuthentication class](/python/api/azureml-core/azureml.core.authentication.azurecliauthentication) reference and in the [Authentication in Azure Machine Learning](https://aka.ms/pl-restep-auth) notebook.
82
+
To invoke the run of the preceding pipeline, you need a Microsoft Entra authentication header token. The process for getting a token is described in the [AzureCliAuthentication class](/python/api/azureml-core/azureml.core.authentication.azurecliauthentication) reference and in the [Authentication in Azure Machine Learning](https://aka.ms/pl-restep-auth) notebook.
81
83
82
84
```python
83
85
from azureml.pipeline.core import PublishedPipeline
The `json` argument to the POST request must contain, for the `ParameterAssignments` key, a dictionary containing the pipeline parameters and their values. In addition, the `json` argument may contain the following keys:
94
+
The `json` argument to the POST request must contain, for the `ParameterAssignments` key, a dictionary that contains the pipeline parameters and their values. In addition, the `json` argument can contain the following keys:
93
95
94
96
| Key | Description |
95
97
| --- | --- |
96
-
|`ExperimentName`| The name of the experiment associated with this endpoint |
97
-
|`Description`| Freeform text describing the endpoint |
98
-
|`Tags`| Freeform key-value pairs that can be used to label and annotate requests |
99
-
|`DataSetDefinitionValueAssignments`|Dictionary used for changing datasets without retraining (see discussion below) |
100
-
|`DataPathAssignments`|Dictionary used for changing datapaths without retraining (see discussion below) |
98
+
|`ExperimentName`| The name of the experiment associated with the endpoint.|
99
+
|`Description`| Freeform text that describes the endpoint.|
100
+
|`Tags`| Freeform key-value pairs that can be used to label and annotate requests.|
101
+
|`DataSetDefinitionValueAssignments`|A dictionary that's used for changing datasets without retraining. (See the discussion later in this article.) |
102
+
|`DataPathAssignments`|A dictionary that's used for changing datapaths without retraining. (See the discussion later in this article.) |
101
103
102
-
### Run a published pipeline using C#
104
+
### Run a published pipeline by using C#
103
105
104
-
The following code shows how to call a pipeline asynchronously from C#. The partial code snippet just shows the call structure and isn't part of a Microsoft sample. It doesn't show complete classes or error handling.
106
+
The following code shows how to call a pipeline asynchronously from C#. The partial code snippet just shows the call structure. It doesn't show complete classes or error handling. It isn't part of a Microsoft sample.
105
107
106
108
```csharp
107
109
[DataContract]
@@ -138,7 +140,7 @@ using (HttpClient client = new HttpClient())
@@ -154,9 +156,9 @@ using (HttpClient client = new HttpClient())
154
156
}
155
157
```
156
158
157
-
### Run a published pipeline using Java
159
+
### Run a published pipeline by using Java
158
160
159
-
The following code shows a call to a pipeline that requires authentication (see[Set up authentication for Azure Machine Learning resources and workflows](how-to-setup-authentication.md)). If your pipeline is deployed publicly, you don't need the calls that produce `authKey`. The partial code snippet doesn't show Java class and exception-handling boilerplate. The code uses `Optional.flatMap` for chaining together functions that may return an empty `Optional`. The use of `flatMap` shortens and clarifies the code, but note that `getRequestBody()` swallows exceptions.
161
+
The following code shows a call to a pipeline that requires authentication. (See[Set up authentication for Azure Machine Learning resources and workflows](how-to-setup-authentication.md).) If your pipeline is deployed publicly, you don't need the calls that produce `authKey`. The partial code snippet doesn't show Java class and exception-handling boilerplate. The code uses `Optional.flatMap` for chaining together functions that might return an empty `Optional`. The use of `flatMap` shortens and clarifies the code, but note that `getRequestBody()` swallows exceptions.
### Changing datasets and datapaths without retraining
243
+
### Change datasets and datapaths without retraining
242
244
243
-
You might want to train and inference on different datasets and datapaths. For instance, you may wish to train on a smaller dataset but inference on the complete dataset. You switch datasets with the `DataSetDefinitionValueAssignments` key in the request's `json` argument. You switch datapaths with `DataPathAssignments`. The technique for both is similar:
245
+
You might want to train and inference on different datasets and datapaths. For example, you might want to train on a smaller dataset but inference on the complete dataset. You can switch datasets by using the `DataSetDefinitionValueAssignments` key in the request's `json` argument. You can switch datapaths by using `DataPathAssignments`. The technique is similar for both:
244
246
245
247
1. In your pipeline definition script, create a `PipelineParameter` for the dataset. Create a `DatasetConsumptionConfig` or `DataPath` from the `PipelineParameter`:
246
248
@@ -250,19 +252,19 @@ You might want to train and inference on different datasets and datapaths. For i
Notice that the MLscript accesses the value specified forthe `DatasetConsumptionConfig` (`tabular_dataset`) andnot the value of the`PipelineParameter` (`tabular_ds_param`).
265
+
Notice that the machine learning script accesses the value specified for`DatasetConsumptionConfig` (`tabular_dataset`) andnot the value of `PipelineParameter` (`tabular_ds_param`).
264
266
265
-
1. In your pipeline definition script, setthe `DatasetConsumptionConfig`as a parameter to the`PipelineScriptStep`:
267
+
1. In your pipeline definition script, set`DatasetConsumptionConfig`as a parameter to `PipelineScriptStep`:
266
268
267
269
```python
268
270
train_step = PythonScriptStep(
@@ -294,11 +296,11 @@ You might want to train and inference on different datasets and datapaths. For i
294
296
}}}})
295
297
```
296
298
297
-
The notebooks [Showcasing Dataset and PipelineParameter](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-dataset-and-pipelineparameter.ipynb) and [Showcasing DataPath and PipelineParameter](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-datapath-and-pipelineparameter.ipynb) have complete examples of this technique.
299
+
The notebooks [Showcasing Dataset and PipelineParameter](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-dataset-and-pipelineparameter.ipynb) and [Showcasing DataPath and PipelineParameter](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-datapath-and-pipelineparameter.ipynb) include complete examples of this technique.
298
300
299
301
## Create a versioned pipeline endpoint
300
302
301
-
You can create a Pipeline Endpoint withmultiple published pipelines behind it. This technique gives you a fixed REST endpoint as you iterate on and update your ML pipelines.
303
+
You can create a pipeline endpoint that has multiple published pipelines behind it. This technique gives you a fixed REST endpoint as you iterate on and update your machine learning pipelines.
302
304
303
305
```python
304
306
from azureml.pipeline.core import PipelineEndpoint
@@ -344,27 +346,28 @@ You can also run a published pipeline from the studio:
344
346
345
347
1.[View your workspace](../how-to-manage-workspace.md#find-a-workspace).
346
348
347
-
1. On the left, select **Endpoints**.
349
+
1. In the left menu, select **Endpoints**.
350
+
351
+
1. Select **Pipeline endpoints**:
348
352
349
-
1. On the top, select **Pipeline endpoints**.
350
-

353
+
:::image type="content" source="../media/how-to-create-your-first-pipeline/pipeline-endpoints.png" alt-text="Screenshot that shows the list of published endpoints." lightbox ="../media/how-to-create-your-first-pipeline/pipeline-endpoints.png":::
351
354
352
355
1. Select a specific pipeline to run, consume, or review results of previous runs of the pipeline endpoint.
353
356
354
357
## Disable a published pipeline
355
358
356
-
To hide a pipeline from your list of published pipelines, you disable it, either in the studio or from the SDK:
359
+
To hide a pipeline from your list of published pipelines, you disable it, either in the studio or via the SDK:
357
360
358
361
```python
359
362
# Get the pipeline by using its ID from Azure Machine Learning studio
360
363
p = PublishedPipeline.get(ws, id="068f4885-7088-424b-8ce2-eeb9ba5381a6")
361
364
p.disable()
362
365
```
363
366
364
-
You can enable it again with `p.enable()`. For more information, see [PublishedPipeline class](/python/api/azureml-pipeline-core/azureml.pipeline.core.publishedpipeline) reference.
367
+
You can enable it again by using `p.enable()`. For more information, see the[PublishedPipeline class](/python/api/azureml-pipeline-core/azureml.pipeline.core.publishedpipeline) reference.
365
368
366
369
## Next steps
367
370
368
-
- Use [these Jupyter notebooks on GitHub](https://aka.ms/aml-pipeline-readme) to explore machine learning pipelines further.
369
-
- See the SDK reference help for the [azureml-pipelines-core](/python/api/azureml-pipeline-core/azureml.pipeline.core) package and the [azureml-pipelines-steps](/python/api/azureml-pipeline-steps/azureml.pipeline.steps) package.
370
-
-See the [how-to](how-to-debug-pipelines.md)for tips on debugging and troubleshooting pipelines.
371
+
- Use [these Jupyter notebooks on GitHub](https://aka.ms/aml-pipeline-readme) to further explore machine learning pipelines.
372
+
- See the SDK reference for the [azureml-pipelines-core](/python/api/azureml-pipeline-core/azureml.pipeline.core) package and the [azureml-pipelines-steps](/python/api/azureml-pipeline-steps/azureml.pipeline.steps) package.
373
+
-For tips on debugging and troubleshooting pipelines, see [How to debug pipelines](how-to-debug-pipelines.md) .
0 commit comments