Skip to content

Commit 6414310

Browse files
Merge pull request #212243 from xanwal/alwallace/localdebugedit
Fix model path in How to Debug Managed Online Endpoints in Visual Studio Code
2 parents 9330e8c + 76b635e commit 6414310

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

articles/machine-learning/how-to-debug-managed-online-endpoints-visual-studio-code.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ from azure.ai.ml.entities import (
109109
CodeConfiguration,
110110
Environment,
111111
)
112-
from azure.identity import DefaultAzureCredential, AzureCliCredential
112+
from azure.identity import DefaultAzureCredential
113113
```
114114

115115
Set up variables for the workspace and endpoint:
@@ -164,7 +164,7 @@ Azure Machine Learning local endpoints use Docker and VS Code development contai
164164
Get a handle to the workspace:
165165

166166
```python
167-
credential = AzureCliCredential()
167+
credential = DefaultAzureCredential()
168168
ml_client = MLClient(
169169
credential,
170170
subscription_id=subscription_id,
@@ -179,7 +179,7 @@ To debug online endpoints locally in VS Code, set the `vscode-debug` and `local`
179179
deployment = ManagedOnlineDeployment(
180180
name="blue",
181181
endpoint_name=endpoint_name,
182-
model=Model(path="../model-1/model"),
182+
model=Model(path="../model-1/model/sklearn_regression_model.pkl"),
183183
code_configuration=CodeConfiguration(
184184
code="../model-1/onlinescoring", scoring_script="score.py"
185185
),
@@ -192,9 +192,7 @@ deployment = ManagedOnlineDeployment(
192192
)
193193

194194
deployment = ml_client.online_deployments.begin_create_or_update(
195-
deployment,
196-
local=True,
197-
vscode_debug=True,
195+
deployment, local=True, vscode_debug=True
198196
)
199197
```
200198

@@ -314,7 +312,7 @@ endpoint = ml_client.online_endpoints.get(name=endpoint_name, local=True)
314312
315313
request_file_path = "../model-1/sample-request.json"
316314
317-
endpoint.invoke(endpoint_name, request_file_path, local=True)
315+
ml_client.online_endpoints.invoke(endpoint_name, request_file_path, local=True)
318316
```
319317
320318
In this case, `<REQUEST-FILE>` is a JSON file that contains input data samples for the model to make predictions on similar to the following JSON:
@@ -330,8 +328,7 @@ In this case, `<REQUEST-FILE>` is a JSON file that contains input data samples f
330328
> The scoring URI is the address where your endpoint listens for requests. The `as_dict` method of endpoint objects returns information similar to `show` in the Azure CLI. The endpoint object can be obtained through `.get`.
331329
>
332330
> ```python
333-
> endpoint = ml_client.online_endpoints.get(endpoint_name, local=True)
334-
> endpoint.as_dict()
331+
> print(endpoint)
335332
> ```
336333
>
337334
> The output should look similar to the following:
@@ -398,7 +395,7 @@ For more extensive changes involving updates to your environment and endpoint co
398395
new_deployment = ManagedOnlineDeployment(
399396
name="green",
400397
endpoint_name=endpoint_name,
401-
model=Model(path="../model-2/model"),
398+
model=Model(path="../model-2/model/sklearn_regression_model.pkl"),
402399
code_configuration=CodeConfiguration(
403400
code="../model-2/onlinescoring", scoring_script="score.py"
404401
),
@@ -410,7 +407,9 @@ new_deployment = ManagedOnlineDeployment(
410407
instance_count=2,
411408
)
412409
413-
ml_client.online_deployments.update(new_deployment, local=True, vscode_debug=True)
410+
deployment = ml_client.online_deployments.begin_create_or_update(
411+
new_deployment, local=True, vscode_debug=True
412+
)
414413
```
415414
416415
Once the updated image is built and your development container launches, use the VS Code debugger to test and troubleshoot your updated endpoint.

0 commit comments

Comments
 (0)