Skip to content

Commit 4e2eed2

Browse files
committed
freshness update
1 parent 3280d0c commit 4e2eed2

File tree

1 file changed

+113
-95
lines changed

1 file changed

+113
-95
lines changed

articles/machine-learning/concept-azure-machine-learning-v2.md

Lines changed: 113 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
1010
ms.author: balapv
1111
author: balapv
1212
ms.reviewer: sgilley
13-
ms.date: 11/04/2022
13+
ms.date: 02/27/2024
1414
#Customer intent: As a data scientist, I want to understand the big picture about how Azure Machine Learning works.
1515
---
1616

@@ -34,23 +34,45 @@ Azure Machine Learning includes several resources and assets to enable you to pe
3434

3535
This document provides a quick overview of these resources and assets.
3636

37-
## Workspace
37+
## Prerequisites
3838

39-
The workspace is the top-level resource for Azure Machine Learning, providing a centralized place to work with all the artifacts you create when you use Azure Machine Learning. The workspace keeps a history of all jobs, including logs, metrics, output, and a snapshot of your scripts. The workspace stores references to resources like datastores and compute. It also holds all assets like models, environments, components and data asset.
39+
### [Python SDK](#tab/sdk)
4040

41-
### Create a workspace
41+
To use the Python SDK code examples in this article, create a connection to your Azure Machine Learning subscription. The examples all rely on `ml_client`.
4242

43-
### [Azure CLI](#tab/cli)
43+
```python
44+
# import required libraries
45+
from azure.ai.ml import MLClient
46+
from azure.ai.ml.entities import Workspace
47+
from azure.identity import DefaultAzureCredential
4448

45-
To create a workspace using CLI v2, use the following command:
49+
# Enter details of your subscription
50+
subscription_id = "<SUBSCRIPTION_ID>"
51+
resource_group = "<RESOURCE_GROUP>"
4652

47-
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
53+
# get a handle to the subscription (use this if you haven't created a workspace yet)
54+
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group)
4855

49-
```bash
50-
az ml workspace create --file my_workspace.yml
56+
# for all examples after creating a workspace, also include the workspace name:
57+
workspace_name = "<WORKSPACE_NAME>"
58+
ml_client = ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace_name)
5159
```
5260

53-
For more information, see [workspace YAML schema](reference-yaml-workspace.md).
61+
### [Azure CLI](#tab/cli)
62+
63+
To use the Azure CLI code examples in this article, you need to have the Azure CLI installed and configured. You can install the Azure CLI from the [Azure CLI documentation](https://docs.microsoft.com/cli/azure/install-azure-cli).
64+
65+
### [Studio](#tab/azure-studio)
66+
67+
Sign in to [Azure Machine Learning studio](https://ml.azure.com).
68+
69+
---
70+
71+
## Workspace
72+
73+
The workspace is the top-level resource for Azure Machine Learning, providing a centralized place to work with all the artifacts you create when you use Azure Machine Learning. The workspace keeps a history of all jobs, including logs, metrics, output, and a snapshot of your scripts. The workspace stores references to resources like datastores and compute. It also holds all assets like models, environments, components and data asset.
74+
75+
### Create a workspace
5476

5577
### [Python SDK](#tab/sdk)
5678

@@ -59,48 +81,53 @@ To create a workspace using Python SDK v2, you can use the following code:
5981
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
6082

6183
```python
62-
ws_basic = Workspace(
63-
name="my-workspace",
64-
location="eastus", # Azure region (location) of workspace
65-
display_name="Basic workspace-example",
66-
description="This example shows how to create a basic workspace"
84+
# specify the workspace details
85+
ws = Workspace(
86+
name="my_workspace",
87+
location="eastus",
88+
display_name="My workspace",
89+
description="This example shows how to create a workspace",
90+
tags=dict(purpose="demo"),
6791
)
68-
ml_client.workspaces.begin_create(ws_basic) # use MLClient to connect to the subscription and resource group and create workspace
92+
93+
ml_client.workspaces.begin_create(ws) # use MLClient to connect to the subscription and resource group and create workspace
6994
```
7095

7196
This [Jupyter notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/resources/workspace/workspace.ipynb) shows more ways to create an Azure Machine Learning workspace using SDK v2.
7297

73-
---
74-
75-
## Compute
98+
### [Azure CLI](#tab/cli)
7699

77-
A compute is a designated compute resource where you run your job or host your endpoint. Azure Machine Learning supports the following types of compute:
100+
To create a workspace using CLI v2, use the following command:
78101

79-
* **Compute cluster** - a managed-compute infrastructure that allows you to easily create a cluster of CPU or GPU compute nodes in the cloud.
102+
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
80103

81-
[!INCLUDE [serverless compute](./includes/serverless-compute.md)]
104+
```bash
105+
az ml workspace create --file my_workspace.yml
106+
```
82107

83-
* **Compute instance** - a fully configured and managed development environment in the cloud. You can use the instance as a training or inference compute for development and testing. It's similar to a virtual machine on the cloud.
84-
* **Inference cluster** - used to deploy trained machine learning models to Azure Kubernetes Service. You can create an Azure Kubernetes Service (AKS) cluster from your Azure Machine Learning workspace, or attach an existing AKS cluster.
85-
* **Attached compute** - You can attach your own compute resources to your workspace and use them for training and inference.
108+
For more information, see [workspace YAML schema](reference-yaml-workspace.md).
86109

110+
### [Studio](#tab/azure-studio)
87111

88-
### [Azure CLI](#tab/cli)
112+
Create a workspace in the studio welcome page by selecting **Create workspace**.
89113

90-
To create a compute using CLI v2, use the following command:
114+
---
91115

92-
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
116+
## Compute
93117

94-
```bash
95-
az ml compute --file my_compute.yml
96-
```
118+
A compute is a designated compute resource where you run your job or host your endpoint. Azure Machine Learning supports the following types of compute:
97119

98-
For more information, see [compute YAML schema](reference-yaml-overview.md#compute).
120+
* **Compute instance** - a fully configured and managed development environment in the cloud. You can use the instance as a training or inference compute for development and testing. It's similar to a virtual machine on the cloud.
121+
* **Compute cluster** - a managed-compute infrastructure that allows you to easily create a cluster of CPU or GPU compute nodes in the cloud.
122+
* **Serverless compute** - a compute cluster you access on the fly. When you use serverless compute, you don't need to create your own cluster. All compute lifecycle management is offloaded to Azure Machine Learning.
123+
* **Inference cluster** - used to deploy trained machine learning models to Azure Kubernetes Service. You can create an Azure Kubernetes Service (AKS) cluster from your Azure Machine Learning workspace, or attach an existing AKS cluster.
124+
* **Attached compute** - You can attach your own compute resources to your workspace and use them for training and inference.
99125

126+
### Create a compute
100127

101128
### [Python SDK](#tab/sdk)
102129

103-
To create a compute using Python SDK v2, you can use the following code:
130+
To create a compute cluster using Python SDK v2, you can use the following code:
104131

105132
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
106133

@@ -119,6 +146,25 @@ ml_client.begin_create_or_update(cluster_basic)
119146

120147
This [Jupyter notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/resources/compute/compute.ipynb) shows more ways to create compute using SDK v2.
121148

149+
### [Azure CLI](#tab/cli)
150+
151+
To create a compute using CLI v2, use the following command:
152+
153+
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
154+
155+
```bash
156+
az ml compute --file my_compute.yml
157+
```
158+
159+
For more information, see [compute YAML schema](reference-yaml-overview.md#compute).
160+
161+
### [Studio](#tab/azure-studio)
162+
163+
1. Select a workspace if you are not already in one.
164+
1. From the left-hand menu, select **Compute**.
165+
1. On the top, select a tab to specify the type of compute you want to create.
166+
1. Select **New** to create the new compute.
167+
1.
122168
---
123169

124170
## Datastore
@@ -130,17 +176,7 @@ Azure Machine Learning datastores securely keep the connection information to yo
130176
* Azure Data Lake
131177
* Azure Data Lake Gen2
132178

133-
### [Azure CLI](#tab/cli)
134-
135-
To create a datastore using CLI v2, use the following command:
136-
137-
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
138-
139-
```bash
140-
az ml datastore create --file my_datastore.yml
141-
```
142-
For more information, see [datastore YAML schema](reference-yaml-overview.md#datastore).
143-
179+
### Create a datastore
144180

145181
### [Python SDK](#tab/sdk)
146182

@@ -149,8 +185,10 @@ To create a datastore using Python SDK v2, you can use the following code:
149185
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
150186

151187
```python
188+
import AzureBlobDatastore
189+
152190
blob_datastore1 = AzureBlobDatastore(
153-
name="blob-example",
191+
name="blob_example",
154192
description="Datastore pointing to a blob container.",
155193
account_name="mytestblobstore",
156194
container_name="data-container",
@@ -163,49 +201,40 @@ ml_client.create_or_update(blob_datastore1)
163201

164202
This [Jupyter notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/resources/datastores/datastore.ipynb) shows more ways to create datastores using SDK v2.
165203

166-
---
167-
168-
## Model
169-
170-
Azure machine learning models consist of the binary file(s) that represent a machine learning model and any corresponding metadata. Models can be created from a local or remote file or directory. For remote locations `https`, `wasbs` and `azureml` locations are supported. The created model will be tracked in the workspace under the specified name and version. Azure Machine Learning supports three types of storage format for models:
171-
172-
* `custom_model`
173-
* `mlflow_model`
174-
* `triton_model`
175-
176-
### Creating a model
177-
178204
### [Azure CLI](#tab/cli)
179205

180-
To create a model using CLI v2, use the following command:
206+
To create a datastore using CLI v2, use the following command:
181207

182208
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
183209

184210
```bash
185-
az ml model create --file my_model.yml
211+
az ml datastore create --file my_datastore.yml
186212
```
187213

188-
For more information, see [model YAML schema](reference-yaml-model.md).
214+
For more information, see [datastore YAML schema](reference-yaml-overview.md#datastore).
189215

216+
### [Studio](#tab/azure-studio)
190217

191-
### [Python SDK](#tab/sdk)
218+
1. Select a workspace if you are not already in one.
219+
1. From the left-hand menu, select **Data**.
220+
1. On the top, select **Datastores**.
221+
1. Select **Create** to create a new datastore.
192222

193-
To create a model using Python SDK v2, you can use the following code:
223+
---
194224

195-
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
225+
## Model
196226

197-
```python
198-
my_model = Model(
199-
path="model.pkl", # the path to where my model file is located
200-
type="custom_model", # can be custom_model, mlflow_model or triton_model
201-
name="my-model",
202-
description="Model created from local file.",
203-
)
227+
Azure machine learning models consist of the binary file(s) that represent a machine learning model and any corresponding metadata. Models can be created from a local or remote file or directory. For remote locations `https`, `wasbs` and `azureml` locations are supported. The created model will be tracked in the workspace under the specified name and version. Azure Machine Learning supports three types of storage format for models:
204228

205-
ml_client.models.create_or_update(my_model) # use the MLClient to connect to workspace and create/register the model
206-
```
229+
* `custom_model`
230+
* `mlflow_model`
231+
* `triton_model`
207232

208-
---
233+
### Create a model in the model registry
234+
235+
Model registration allows you to store and version your models in the Azure cloud, in your workspace. The model registry helps you organize and keep track of your trained models.
236+
237+
For more information on how to create models in the registry, see [Work with models in Azure Machine Learning](how-to-manage-models).
209238

210239
## Environment
211240

@@ -225,36 +254,25 @@ In custom environments, you're responsible for setting up your environment and i
225254

226255
### Create an Azure Machine Learning custom environment
227256

228-
### [Azure CLI](#tab/cli)
229-
230-
To create an environment using CLI v2, use the following command:
231-
232-
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
233-
234-
```bash
235-
az ml environment create --file my_environment.yml
236-
```
237-
For more information, see [environment YAML schema](reference-yaml-environment.md).
238257

258+
### [Python SDK](#tab/sdk)
239259

260+
To create an environment using Python SDK v2, see [Create an envirnment](how-to-manage-environments-v2&tabs=python#create-an-environment).
240261

241-
### [Python SDK](#tab/sdk)
262+
This [Jupyter notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/assets/environment/environment.ipynb) shows more ways to create custom environments using SDK v2.
242263

243-
To create an environment using Python SDK v2, you can use the following code:
264+
### [Azure CLI](#tab/cli)
244265

245-
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
266+
To create an environment using CLI v2, see [Create an envirnment](how-to-manage-environments-v2&tabs=cli#create-an-environment).
246267

247-
```python
248-
my_env = Environment(
249-
image="pytorch/pytorch:latest", # base image to use
250-
name="docker-image-example", # name of the model
251-
description="Environment created from a Docker image.",
252-
)
268+
For more information, see [environment YAML schema](reference-yaml-environment.md).
253269

254-
ml_client.environments.create_or_update(my_env) # use the MLClient to connect to workspace and create/register the environment
255-
```
270+
### [Studio](#tab/azure-studio)
256271

257-
This [Jupyter notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/assets/environment/environment.ipynb) shows more ways to create custom environments using SDK v2.
272+
1. Select a workspace if you are not already in one.
273+
1. From the left-hand menu, select **Environments**.
274+
1. On the top, select **Custom environments**.
275+
1. Select **Create** to create a new custom environment.
258276

259277
---
260278

0 commit comments

Comments
 (0)