Skip to content

Commit 920c055

Browse files
committed
Change install, and use V1 workspace config
1 parent 71f25a0 commit 920c055

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

articles/machine-learning/tutorial-1st-experiment-bring-data.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,25 @@ from azure.ai.ml.entities import Environment
180180
from azure.ai.ml import command, Input
181181
from azure.ai.ml.entities import Data
182182
from azure.ai.ml.constants import AssetTypes
183+
from azureml.core import Workspace
183184

184185
if __name__ == "__main__":
186+
# get details of the current Azure ML workspace
187+
ws = Workspace.from_config()
188+
185189
# default authentication flow for Azure applications
186190
default_azure_credential = DefaultAzureCredential()
187-
subscription_id = "<SUBSCRIPTION_ID>"
188-
resource_group = "<RESOURCE_GROUP>"
189-
workspace = "<AML_WORKSPACE_NAME>"
191+
subscription_id = ws.subscription_id
192+
resource_group = ws.resource_group
193+
workspace = ws.name
190194

191195
# client class to interact with Azure ML services and resources, e.g. workspaces, jobs, models and so on.
192196
ml_client = MLClient(
193197
default_azure_credential,
194198
subscription_id,
195199
resource_group,
196200
workspace)
201+
197202
# the key here should match the key passed to the command
198203
my_job_inputs = {
199204
"data_path": Input(type=AssetTypes.URI_FOLDER, path="./data")

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

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@ In this tutorial, you will:
3333
## Prerequisites
3434

3535
- Complete [Quickstart: Set up your workspace to get started with Azure Machine Learning](quickstart-create-resources.md) to create a workspace, compute instance, and compute cluster to use in this tutorial series.
36-
- If an older compute instance is used, install `azure-ai-ml` by running the below command in a notebook cell. New compute instances will have this package pre-installed.
3736

38-
```python
39-
pip install azure-ai-ml
40-
```
37+
- The Azure Machine Learning Python SDK v2 (preview) installed.
38+
39+
To install the SDK you can either,
40+
* Create a compute instance, which automatically installs the SDK and is pre-configured for ML workflows. For more information, see [Create and manage an Azure Machine Learning compute instance](how-to-create-manage-compute-instance.md).
41+
42+
* Use the following commands to install Azure ML Python SDK v2:
43+
* Uninstall previous preview version:
44+
```python
45+
pip uninstall azure-ai-ml
46+
```
47+
* Install the Azure ML Python SDK v2:
48+
```python
49+
pip install azure-ai-ml
50+
```
4151

4252
## Create and run a Python script
4353

@@ -89,14 +99,18 @@ Select the **...** at the end of **get-started** folder to create a new file. Cr
8999
# get-started/run-hello.py
90100
from azure.ai.ml import MLClient, command, Input
91101
from azure.identity import DefaultAzureCredential
102+
from azureml.core import Workspace
103+
104+
# get details of the current Azure ML workspace
105+
ws = Workspace.from_config()
92106

93107
# default authentication flow for Azure applications
94108
default_azure_credential = DefaultAzureCredential()
95-
subscription_id = "<SUBSCRIPTION_ID>"
96-
resource_group = "<RESOURCE_GROUP>"
97-
workspace = "<AML_WORKSPACE_NAME>"
109+
subscription_id = ws.subscription_id
110+
resource_group = ws.resource_group
111+
workspace = ws.name
98112

99-
# Client class to interact with Azure ML services and resources, e.g. workspaces, jobs, models and so on.
113+
# client class to interact with Azure ML services and resources, e.g. workspaces, jobs, models and so on.
100114
ml_client = MLClient(
101115
default_azure_credential,
102116
subscription_id,
@@ -130,7 +144,7 @@ Here's a description of how the control script works:
130144
`ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace)`
131145
:::column-end:::
132146
:::column span="2":::
133-
[MlClient](/python/api/azure-ai-ml/azure.ai.ml.mlclient) manages your Azure Machine Learning workspace and it's assets and resources.
147+
[MLClient](/python/api/azure-ai-ml/azure.ai.ml.mlclient) manages your Azure Machine Learning workspace and it's assets and resources.
134148
:::column-end:::
135149
:::row-end:::
136150
:::row:::

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,19 @@ Create a new Python file in the **get-started** folder called `run-pytorch.py`:
177177
from azure.ai.ml import MLClient, command, Input
178178
from azure.identity import DefaultAzureCredential
179179
from azure.ai.ml.entities import Environment
180+
from azureml.core import Workspace
180181

181182
if __name__ == "__main__":
183+
# get details of the current Azure ML workspace
184+
ws = Workspace.from_config()
185+
182186
# default authentication flow for Azure applications
183187
default_azure_credential = DefaultAzureCredential()
184-
subscription_id = "<SUBSCRIPTION_ID>"
185-
resource_group = "<RESOURCE_GROUP>"
186-
workspace = "<AML_WORKSPACE_NAME>"
188+
subscription_id = ws.subscription_id
189+
resource_group = ws.resource_group
190+
workspace = ws.name
187191

188-
# Client class to interact with Azure ML services and resources, e.g. workspaces, jobs, models and so on.
192+
# client class to interact with Azure ML services and resources, e.g. workspaces, jobs, models and so on.
189193
ml_client = MLClient(
190194
default_azure_credential,
191195
subscription_id,

0 commit comments

Comments
 (0)