Skip to content

Commit cf358d6

Browse files
committed
freshness update set-up-training-targets
1 parent e5baa2f commit cf358d6

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

articles/machine-learning/v1/how-to-set-up-training-targets.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: sgilley
88
ms.reviewer: sgilley
99
ms.service: machine-learning
1010
ms.subservice: training
11-
ms.date: 10/21/2021
11+
ms.date: 02/21/2024
1212
ms.topic: how-to
1313
ms.custom: UpdateFrequency5,sdkv1
1414
---
@@ -26,11 +26,12 @@ All you need to do is define the environment for each compute target within a **
2626
## Prerequisites
2727

2828
* If you don't have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/) today
29-
* The [Azure Machine Learning SDK for Python](/python/api/overview/azure/ml/install) (>= 1.13.0)
29+
* The [Azure Machine Learning SDK for Python (v1)](/python/api/overview/azure/ml/install) (>= 1.13.0)
3030
* An [Azure Machine Learning workspace](../how-to-manage-workspace.md), `ws`
3131
* A compute target, `my_compute_target`. [Create a compute target](../how-to-create-attach-compute-studio.md)
3232

3333
## What's a script run configuration?
34+
3435
A [ScriptRunConfig](/python/api/azureml-core/azureml.core.scriptrunconfig) is used to configure the information necessary for submitting a training job as part of an experiment.
3536

3637
You submit your training experiment with a ScriptRunConfig object. This object includes the:
@@ -60,6 +61,8 @@ Or you can:
6061

6162
Create an [experiment](concept-azure-machine-learning-architecture.md#experiments) in your workspace. An experiment is a light-weight container that helps to organize job submissions and keep track of code.
6263

64+
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
65+
6366
```python
6467
from azureml.core import Experiment
6568

@@ -84,6 +87,8 @@ You can either define your own environment, or use an Azure Machine Learning cur
8487

8588
For a remote compute target, you can use one of these popular curated environments to start with:
8689

90+
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
91+
8792
```python
8893
from azureml.core import Workspace, Environment
8994

@@ -97,6 +102,8 @@ For more information and details about environments, see [Create & use software
97102

98103
If your compute target is your **local machine**, you are responsible for ensuring that all the necessary packages are available in the Python environment where the script runs. Use `python.user_managed_dependencies` to use your current Python environment (or the Python on the path you specify).
99104

105+
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
106+
100107
```python
101108
from azureml.core import Environment
102109

@@ -111,6 +118,8 @@ myenv.python.user_managed_dependencies = True
111118

112119
Now that you have a compute target (`my_compute_target`, see [Prerequisites](#prerequisites) and environment (`myenv`, see [Create an environment](#create-an-environment)), create a script job configuration that runs your training script (`train.py`) located in your `project_folder` directory:
113120

121+
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
122+
114123
```python
115124
from azureml.core import ScriptRunConfig
116125

@@ -119,9 +128,6 @@ src = ScriptRunConfig(source_directory=project_folder,
119128
compute_target=my_compute_target,
120129
environment=myenv)
121130

122-
# Set compute target
123-
# Skip this if you are running on your local computer
124-
script_run_config.run_config.target = my_compute_target
125131
```
126132

127133
If you do not specify an environment, a default environment will be created for you.
@@ -131,6 +137,7 @@ If you have command-line arguments you want to pass to your training script, you
131137
If you want to override the default maximum time allowed for the job, you can do so via the **`max_run_duration_seconds`** parameter. The system will attempt to automatically cancel the job if it takes longer than this value.
132138

133139
### Specify a distributed job configuration
140+
134141
If you want to run a [distributed training](../how-to-train-distributed-gpu.md) job, provide the distributed job-specific config to the **`distributed_job_config`** parameter. Supported config types include [MpiConfiguration](/python/api/azureml-core/azureml.core.runconfig.mpiconfiguration), [TensorflowConfiguration](/python/api/azureml-core/azureml.core.runconfig.tensorflowconfiguration), and [PyTorchConfiguration](/python/api/azureml-core/azureml.core.runconfig.pytorchconfiguration).
135142

136143
For more information and examples on running distributed Horovod, TensorFlow and PyTorch jobs, see:
@@ -139,6 +146,8 @@ For more information and examples on running distributed Horovod, TensorFlow and
139146

140147
## Submit the experiment
141148

149+
[!INCLUDE [sdk v1](../includes/machine-learning-sdk-v1.md)]
150+
142151
```python
143152
run = experiment.submit(config=src)
144153
run.wait_for_completion(show_output=True)

0 commit comments

Comments
 (0)