Skip to content

Commit 0fdede0

Browse files
committed
acrolinx pass
1 parent 03dae7c commit 0fdede0

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

articles/machine-learning/v1/tutorial-1st-experiment-hello-world.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: tutorial
99
author: aminsaied
1010
ms.author: amsaied
1111
ms.reviewer: sgilley
12-
ms.date: 07/29/2022
12+
ms.date: 04/03/2024
1313
ms.custom: UpdateFrequency5, devx-track-python, sdkv1
1414
---
1515

@@ -20,7 +20,7 @@ ms.custom: UpdateFrequency5, devx-track-python, sdkv1
2020

2121
In this tutorial, you run your first Python script in the cloud with Azure Machine Learning. This tutorial is *part 1 of a two-part tutorial series*.
2222

23-
This tutorial avoids the complexity of training a machine learning model. You will run a "Hello World" Python script in the cloud. You will learn how a control script is used to configure and create a run in Azure Machine Learning.
23+
This tutorial avoids the complexity of training a machine learning model. You'll run a "Hello World" Python script in the cloud. You'll learn how a control script is used to configure and create a run in Azure Machine Learning.
2424

2525
In this tutorial, you will:
2626

@@ -38,7 +38,7 @@ In this tutorial, you will:
3838

3939
## Create and run a Python script
4040

41-
This tutorial will use the compute instance as your development computer. First create a few folders and the script:
41+
This tutorial uses the compute instance as your development computer. First create a few folders and the script:
4242

4343
1. Sign in to the [Azure Machine Learning studio](https://ml.azure.com) and select your workspace if prompted.
4444
1. On the left, select **Notebooks**
@@ -47,9 +47,9 @@ This tutorial will use the compute instance as your development computer. First
4747
1. Name the folder **get-started**.
4848
1. To the right of the folder name, use the **...** to create another folder under **get-started**.
4949
:::image type="content" source="../media/tutorial-1st-experiment-hello-world/create-sub-folder.png" alt-text="Screenshot shows create a subfolder menu.":::
50-
1. Name the new folder **src**. Use the **Edit location** link if the file location is not correct.
50+
1. Name the new folder **src**. Use the **Edit location** link if the file location isn't correct.
5151
1. To the right of the **src** folder, use the **...** to create a new file in the **src** folder.
52-
1. Name your file *hello.py*. Switch the **File type** to *Python (*.py)*.
52+
1. Name your file *hello.py*. Switch the **File type** to *Python (*.py)*.
5353

5454
Copy this code into your file:
5555

@@ -65,7 +65,7 @@ Your project folder structure will now look like:
6565

6666
### Test your script
6767

68-
You can run your code locally, which in this case means on the compute instance. Running code locally has the benefit of interactive debugging of code.
68+
You can run your code locally, which in this case means on the compute instance. Running code locally has the benefit of interactive debugging of code.
6969

7070
If you have previously stopped your compute instance, start it now with the **Start compute** tool to the right of the compute dropdown. Wait about a minute for state to change to *Running*.
7171

@@ -75,13 +75,13 @@ Select **Save and run script in terminal** to run the script.
7575

7676
:::image type="content" source="../media/tutorial-1st-experiment-hello-world/save-run-in-terminal.png" alt-text="Screenshot shows save and run script in terminal tool in the toolbar":::
7777

78-
You'll see the output of the script in the terminal window that opens. Close the tab and select **Terminate** to close the session.
78+
You see the output of the script in the terminal window that opens. Close the tab and select **Terminate** to close the session.
7979

8080
## Create a control script
8181

82-
A *control script* allows you to run your `hello.py` script on different compute resources. You use the control script to control how and where your machine learning code is run.
82+
A *control script* allows you to run your `hello.py` script on different compute resources. You use the control script to control how and where your machine learning code is run.
8383

84-
Select the **...** at the end of **get-started** folder to create a new file. Create a Python file called *run-hello.py* and copy/paste the following code into that file:
84+
Select the **...** at the end of **get-started** folder to create a new file. Create a Python file called *run-hello.py* and copy/paste the following code into that file:
8585

8686
```python
8787
# get-started/run-hello.py
@@ -125,23 +125,23 @@ Here's a description of how the control script works:
125125
`config = ScriptRunConfig( ... )`
126126
:::column-end:::
127127
:::column span="2":::
128-
[ScriptRunConfig](/python/api/azureml-core/azureml.core.scriptrunconfig) wraps your `hello.py` code and passes it to your workspace. As the name suggests, you can use this class to _configure_ how you want your _script_ to _run_ in Azure Machine Learning. It also specifies what compute target the script will run on. In this code, the target is the compute cluster that you created in the [setup tutorial](../quickstart-create-resources.md).
128+
[ScriptRunConfig](/python/api/azureml-core/azureml.core.scriptrunconfig) wraps your `hello.py` code and passes it to your workspace. As the name suggests, you can use this class to _configure_ how you want your _script_ to _run_ in Azure Machine Learning. It also specifies what compute target the script runs on. In this code, the target is the compute cluster that you created in the [setup tutorial](../quickstart-create-resources.md).
129129
:::column-end:::
130130
:::row-end:::
131131
:::row:::
132132
:::column span="":::
133133
`run = experiment.submit(config)`
134134
:::column-end:::
135135
:::column span="2":::
136-
Submits your script. This submission is called a [run](/python/api/azureml-core/azureml.core.run%28class%29). In v2, it has been renamed to a job. A run/job encapsulates a single execution of your code. Use a job to monitor the script progress, capture the output, analyze the results, visualize metrics, and more.
136+
Submits your script. This submission is called a [run](/python/api/azureml-core/azureml.core.run%28class%29). In v2, it has been renamed to a job. A run/job encapsulates a single execution of your code. Use a job to monitor the script progress, capture the output, analyze the results, visualize metrics, and more.
137137
:::column-end:::
138138
:::row-end:::
139139
:::row:::
140140
:::column span="":::
141141
`aml_url = run.get_portal_url()`
142142
:::column-end:::
143143
:::column span="2":::
144-
The `run` object provides a handle on the execution of your code. Monitor its progress from the Azure Machine Learning studio with the URL that's printed from the Python script.
144+
The `run` object provides a handle on the execution of your code. Monitor its progress from the Azure Machine Learning studio with the URL that prints from the Python script.
145145
:::column-end:::
146146
:::row-end:::
147147

@@ -150,33 +150,33 @@ Here's a description of how the control script works:
150150

151151
1. Select **Save and run script in terminal** to run your control script, which in turn runs `hello.py` on the compute cluster that you created in the [setup tutorial](../quickstart-create-resources.md).
152152

153-
1. In the terminal, you may be asked to sign in to authenticate. Copy the code and follow the link to complete this step.
153+
1. In the terminal, you may be asked to sign in to authenticate. Copy the code and follow the link to complete this step.
154154

155-
1. Once you're authenticated, you'll see a link in the terminal. Select the link to view the job.
155+
1. Once you're authenticated, you see a link in the terminal. Select the link to view the job.
156156

157157
> [!NOTE]
158158
> You may see some warnings starting with *Failure while loading azureml_run_type_providers...*. You can ignore these warnings. Use the link at the bottom of these warnings to view your output.
159159
160160
## View the output
161161

162-
1. In the page that opens, you'll see the job status.
162+
1. In the page that opens, you see the job status.
163163
1. When the status of the job is **Completed**, select **Output + logs** at the top of the page.
164164
1. Select **std_log.txt** to view the output of your job.
165165

166166
## Monitor your code in the cloud in the studio
167167

168-
The output from your script will contain a link to the studio that looks something like this:
168+
The output from your script contains a link to the studio that looks something like this:
169169
`https://ml.azure.com/experiments/hello-world/runs/<run-id>?wsid=/subscriptions/<subscription-id>/resourcegroups/<resource-group>/workspaces/<workspace-name>`.
170170

171-
Follow the link. At first, you'll see a status of **Queued** or **Preparing**. The very first run will take 5-10 minutes to complete. This is because the following occurs:
171+
Follow the link. At first, you see a status of **Queued** or **Preparing**. The first run takes 5-10 minutes to complete. This is because the following occurs:
172172

173173
* A docker image is built in the cloud
174174
* The compute cluster is resized from 0 to 1 node
175175
* The docker image is downloaded to the compute.
176176

177-
Subsequent jobs are much quicker (~15 seconds) as the docker image is cached on the compute. You can test this by resubmitting the code below after the first job has completed.
177+
Subsequent jobs are quicker (~15 seconds) as the docker image is cached on the compute. You can test this by resubmitting the code below after the first job has completed.
178178

179-
Wait about 10 minutes. You'll see a message that the job has completed. Then use **Refresh** to see the status change to *Completed*. Once the job completes, go to the **Outputs + logs** tab. There you can see a `std_log.txt` file that looks like this:
179+
Wait about 10 minutes. You see a message that the job has completed. Then use **Refresh** to see the status change to *Completed*. Once the job completes, go to the **Outputs + logs** tab. There you can see a `std_log.txt` file that looks like this:
180180

181181
```txt
182182
1: [2020-08-04T22:15:44.407305] Entering context manager injector.

articles/machine-learning/v1/tutorial-1st-experiment-sdk-train.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: tutorial
99
author: aminsaied
1010
ms.author: amsaied
1111
ms.reviewer: sgilley
12-
ms.date: 07/29/2022
12+
ms.date: 04/03/2024
1313
ms.custom: UpdateFrequency5, devx-track-python, contperf-fy21q, sdkv1
1414
---
1515

@@ -18,11 +18,11 @@ ms.custom: UpdateFrequency5, devx-track-python, contperf-fy21q, sdkv1
1818
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
1919

2020

21-
This tutorial shows you how to train a machine learning model in Azure Machine Learning. This tutorial is *part 2 of a two-part tutorial series*.
21+
This tutorial shows you how to train a machine learning model in Azure Machine Learning. This tutorial is *part 2 of a two-part tutorial series*.
2222

23-
In [Part 1: Run "Hello world!"](tutorial-1st-experiment-hello-world.md) of the series, you learned how to use a control script to run a job in the cloud.
23+
In [Part 1: Run "Hello world!"](tutorial-1st-experiment-hello-world.md) of the series, you learned how to use a control script to run a job in the cloud.
2424

25-
In this tutorial, you take the next step by submitting a script that trains a machine learning model. This example will help you understand how Azure Machine Learning eases consistent behavior between local debugging and remote runs.
25+
In this tutorial, you take the next step by submitting a script that trains a machine learning model. This example helps you understand how Azure Machine Learning eases consistent behavior between local debugging and remote runs.
2626

2727
In this tutorial, you:
2828

@@ -42,9 +42,9 @@ In this tutorial, you:
4242

4343
## Create training scripts
4444

45-
First you define the neural network architecture in a *model.py* file. All your training code will go into the `src` subdirectory, including *model.py*.
45+
First you define the neural network architecture in a *model.py* file. All your training code goes into the `src` subdirectory, including *model.py*.
4646

47-
The training code is taken from [this introductory example](https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html) from PyTorch. Note that the Azure Machine Learning concepts apply to any machine learning code, not just PyTorch.
47+
The training code is taken from [this introductory example](https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html) from PyTorch. The Azure Machine Learning concepts apply to any machine learning code, not just PyTorch.
4848

4949
1. Create a *model.py* file in the **src** subfolder. Copy this code into the file:
5050

@@ -72,7 +72,7 @@ The training code is taken from [this introductory example](https://pytorch.org/
7272
x = self.fc3(x)
7373
return x
7474
```
75-
1. On the toolbar, select **Save** to save the file. Close the tab if you wish.
75+
1. On the toolbar, select **Save** to save the file. Close the tab if you wish.
7676

7777
1. Next, define the training script, also in the **src** subfolder. This script downloads the CIFAR10 dataset by using PyTorch `torchvision.dataset` APIs, sets up the network defined in *model.py*, and trains it for two epochs by using standard SGD and cross-entropy loss.
7878

@@ -143,15 +143,15 @@ The training code is taken from [this introductory example](https://pytorch.org/
143143

144144
Select **Save and run script in terminal** to run the *train.py* script directly on the compute instance.
145145

146-
After the script completes, select **Refresh** above the file folders. You'll see the new data folder called **get-started/data** Expand this folder to view the downloaded data.
146+
After the script completes, select **Refresh** above the file folders. You see the new data folder called **get-started/data** Expand this folder to view the downloaded data.
147147

148148
:::image type="content" source="../media/tutorial-1st-experiment-hello-world/directory-with-data.png" alt-text="Screenshot of folders shows new data folder created by running the file locally.":::
149149

150150
## Create a Python environment
151151

152-
Azure Machine Learning provides the concept of an [environment](/python/api/azureml-core/azureml.core.environment.environment) to represent a reproducible, versioned Python environment for running experiments. It's easy to create an environment from a local Conda or pip environment.
152+
Azure Machine Learning provides the concept of an [environment](/python/api/azureml-core/azureml.core.environment.environment) to represent a reproducible, versioned Python environment for running experiments. It's easy to create an environment from a local Conda or pip environment.
153153

154-
First you'll create a file with the package dependencies.
154+
First you create a file with the package dependencies.
155155

156156
1. Create a new file in the **get-started** folder called `pytorch-env.yml`:
157157

@@ -165,7 +165,7 @@ First you'll create a file with the package dependencies.
165165
- pytorch
166166
- torchvision
167167
```
168-
1. On the toolbar, select **Save** to save the file. Close the tab if you wish.
168+
1. On the toolbar, select **Save** to save the file. Close the tab if you wish.
169169

170170
## Create the control script
171171

@@ -226,14 +226,14 @@ if __name__ == "__main__":
226226

227227
1. Select **Save and run script in terminal** to run the *run-pytorch.py* script.
228228

229-
1. You'll see a link in the terminal window that opens. Select the link to view the job.
229+
1. You see a link in the terminal window that opens. Select the link to view the job.
230230

231231
> [!NOTE]
232232
> You may see some warnings starting with *Failure while loading azureml_run_type_providers...*. You can ignore these warnings. Use the link at the bottom of these warnings to view your output.
233233
234234
### View the output
235235

236-
1. In the page that opens, you'll see the job status. The first time you run this script, Azure Machine Learning will build a new Docker image from your PyTorch environment. The whole job might take around 10 minutes to complete. This image will be reused in future jobs to make them run much quicker.
236+
1. In the page that opens, you see the job status. The first time you run this script, Azure Machine Learning builds a new Docker image from your PyTorch environment. The whole job might take around 10 minutes to complete. This image will be reused in future jobs to make them run much quicker.
237237
1. You can see view Docker build logs in the Azure Machine Learning studio. Select the **Outputs + logs** tab, and then select **20_image_build_log.txt**.
238238
1. When the status of the job is **Completed**, select **Output + logs**.
239239
1. Select **std_log.txt** to view the output of your job.
@@ -253,7 +253,7 @@ Finished Training
253253

254254
If you see an error `Your total snapshot size exceeds the limit`, the **data** folder is located in the `source_directory` value used in `ScriptRunConfig`.
255255

256-
Select the **...** at the end of the folder, then select **Move** to move **data** to the **get-started** folder.
256+
Select the **...** at the end of the folder, then select **Move** to move **data** to the **get-started** folder.
257257

258258

259259
## Log training metrics
@@ -367,9 +367,9 @@ Make sure you save this file before you submit the run.
367367
368368
### Submit the run to Azure Machine Learning
369369
370-
Select the tab for the *run-pytorch.py* script, then select **Save and run script in terminal** to re-run the *run-pytorch.py* script. Make sure you've saved your changes to `pytorch-env.yml` first.
370+
Select the tab for the *run-pytorch.py* script, then select **Save and run script in terminal** to rerun the *run-pytorch.py* script. Make sure you save your changes to `pytorch-env.yml` first.
371371

372-
This time when you visit the studio, go to the **Metrics** tab where you can now see live updates on the model training loss! It may take a 1 to 2 minutes before the training begins.
372+
This time when you visit the studio, go to the **Metrics** tab where you can now see live updates on the model training loss! It may take a 1 to 2 minutes before the training begins.
373373

374374
:::image type="content" source="../media/tutorial-1st-experiment-sdk-train/logging-metrics.png" alt-text="Training loss graph on the Metrics tab.":::
375375

0 commit comments

Comments
 (0)