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/how-to-create-component-pipeline-python.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,23 +86,23 @@ The image classification task can be split into three steps: prepare data, train
86
86
87
87
For each component, you need to prepare the following staff:
88
88
89
-
1. Prepare the python script containing the execution logic
89
+
1. Prepare the Python script containing the execution logic
90
90
91
91
1. Define the interface of the component,
92
92
93
93
1. Add other metadata of the component, including run-time environment, command to run the component, and etc.
94
94
95
-
The next section will show create components in two different ways: the first two components using python function and the third component using yaml definition.
95
+
The next section will show create components in two different ways: the first two components using Python function and the third component using yaml definition.
96
96
97
97
### Create the data-preparation component
98
98
99
-
The first component in this pipeline will convert the compressed data files of `fashion_ds` into two csv files, one for training and the other for scoring. You'll use pythonfunctionto define this component.
99
+
The first component in this pipeline will convert the compressed data files of `fashion_ds` into two csv files, one for training and the other for scoring. You'll use Pythonfunctionto define this component.
100
100
101
101
If you're following along with the example in the [AzureML Examples repo](https://github.com/Azure/azureml-examples/tree/main/sdk/python/jobs/pipelines/2e_image_classification_keras_minist_convnet), the source files are already available in `prep/` folder. This folder contains two files to construct the component: `prep_component.py`, which defines the component and `conda.yaml`, which defines the run-time environment of the component.
102
102
103
-
#### Define component using python function
103
+
#### Define component using Python function
104
104
105
-
By using command_component() function as a decorator, you can easily define the component's interface, metadata and code to execute from a python function. Each decorated Python functionwill be transformed into a single static specification (YAML) that the pipeline service can process.
105
+
By using command_component() function as a decorator, you can easily define the component's interface, metadata and code to execute from a Python function. Each decorated Python functionwill be transformed into a single static specification (YAML) that the pipeline service can process.
@@ -134,7 +134,7 @@ Now, you've prepared all source files for the `Prep Data` component.
134
134
135
135
### Create the train-model component
136
136
137
-
In this section, you'll create a component for training the image classification model in the python function like the `Prep Data` component.
137
+
In this section, you'll create a component for training the image classification model in the Python function like the `Prep Data` component.
138
138
139
139
The difference is that since the training logic is more complicated, you can put the original training code in a separate Python file.
140
140
@@ -146,9 +146,9 @@ The source files of this component are under `train/` folder in the [AzureML Exa
146
146
147
147
#### Get a script containing execution logic
148
148
149
-
The `train.py` file contains a normal python function, which performs the training model logic to train a Keras neural network for image classification. You can find the code [here](https://github.com/Azure/azureml-examples/tree/main/sdk/python/jobs/pipelines/2e_image_classification_keras_minist_convnet/train/train.py).
149
+
The `train.py` file contains a normal Python function, which performs the training model logic to train a Keras neural network for image classification. You can find the code [here](https://github.com/Azure/azureml-examples/tree/main/sdk/python/jobs/pipelines/2e_image_classification_keras_minist_convnet/train/train.py).
150
150
151
-
#### Define component using python function
151
+
#### Define component using Python function
152
152
153
153
After defining the training function successfully, you can use @command_component in Azure Machine Learning SDK v2 to wrap your function as a component, which can be used in AzureML pipelines.
154
154
@@ -176,7 +176,7 @@ If you're following along with the example in the [AzureML Examples repo](https:
176
176
177
177
#### Get a script containing execution logic
178
178
179
-
The `score.py` file contains a normal python function, which performs the training model logic.
179
+
The `score.py` file contains a normal Python function, which performs the training model logic.
@@ -203,7 +203,7 @@ Now, you've got all source files for score-model component.
203
203
204
204
## Load components to build pipeline
205
205
206
-
For prep-data component and train-model component defined by python function, you can import the components just like normal python functions.
206
+
For prep-data component and train-model component defined by Python function, you can import the components just like normal Python functions.
207
207
208
208
In the following code, you import `prepare_data_component()` and `keras_train_component()` function from the `prep_component.py` file under `prep` folder and `train_component` file under `train` folder respectively.
209
209
@@ -297,7 +297,7 @@ In the previous section, you have built a pipeline using three components to E2E
Using `ml_client.components.get()`, you can get a registered component by name and version. Using `ml_client.compoennts.create_or_update()`, you can register a component previously loaded from pythonfunctionor yaml.
300
+
Using `ml_client.components.get()`, you can get a registered component by name and version. Using `ml_client.compoennts.create_or_update()`, you can register a component previously loaded from Pythonfunctionor yaml.
0 commit comments