Skip to content

Commit a2c5b9b

Browse files
authored
Merge pull request #94064 from amymsft/patch-2
Add compute to tutorial
2 parents 5f0bf33 + 46e4230 commit a2c5b9b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

articles/machine-learning/how-to-use-batch-endpoint-sdk-v2.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The [workspace](concept-workspace.md) is the top-level resource for Azure Machin
5050
# import required libraries
5151
from azure.ai.ml import MLClient, Input
5252
from azure.ai.ml.entities import (
53+
AmlCompute,
5354
BatchEndpoint,
5455
BatchDeployment,
5556
Model,
@@ -118,6 +119,16 @@ To create an online endpoint, we'll use `BatchEndpoint`. This class allows user
118119
ml_client.begin_create_or_update(endpoint)
119120
```
120121

122+
## Create batch compute
123+
124+
Batch endpoint runs only on cloud computing resources, not locally. The cloud computing resource is a reusable virtual computer cluster. Run the following code to create an Azure Machine Learning compute cluster. The following examples in this article use the compute created here named `cpu-cluster`.
125+
126+
```python
127+
compute_name = "cpu-cluster"
128+
compute_cluster = AmlCompute(name=compute_name, description="amlcompute", min_instances=0, max_instances=5)
129+
ml_client.begin_create_or_update(compute_cluster)
130+
```
131+
121132
## Create a deployment
122133

123134
A deployment is a set of resources required for hosting the model that does the actual inferencing. We'll create a deployment for our endpoint using the `BatchDeployment` class. This class allows user to configure the following key aspects.
@@ -157,7 +168,7 @@ A deployment is a set of resources required for hosting the model that does the
157168
code_path="./mnist/code/",
158169
scoring_script="digit_identification.py",
159170
environment=env,
160-
compute="cpu-cluster",
171+
compute=compute_name,
161172
instance_count=2,
162173
max_concurrency_per_instance=2,
163174
mini_batch_size=10,
@@ -222,4 +233,4 @@ ml_client.batch_endpoints.begin_delete(name=batch_endpoint_name)
222233

223234
## Next steps
224235

225-
If you encounter problems using batch endpoints, see [Troubleshooting batch endpoints](how-to-troubleshoot-batch-endpoints.md).
236+
If you encounter problems using batch endpoints, see [Troubleshooting batch endpoints](how-to-troubleshoot-batch-endpoints.md).

0 commit comments

Comments
 (0)