Skip to content

Commit a1a6932

Browse files
committed
Fix model path issue
1 parent c925657 commit a1a6932

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ from azure.ai.ml.entities import (
115115
CodeConfiguration,
116116
Environment,
117117
)
118-
from azure.identity import DefaultAzureCredential, AzureCliCredential
118+
from azure.identity import AzureCliCredential
119119
```
120120

121121
Set up variables for the workspace and endpoint:
@@ -185,7 +185,7 @@ To debug online endpoints locally in VS Code, set the `vscode-debug` and `local`
185185
deployment = ManagedOnlineDeployment(
186186
name="blue",
187187
endpoint_name=endpoint_name,
188-
model=Model(path="../model-1/model"),
188+
model=Model(path="../model-1/model/sklearn_regression_model.pkl"),
189189
code_configuration=CodeConfiguration(
190190
code="../model-1/onlinescoring", scoring_script="score.py"
191191
),
@@ -198,9 +198,7 @@ deployment = ManagedOnlineDeployment(
198198
)
199199

200200
deployment = ml_client.online_deployments.begin_create_or_update(
201-
deployment,
202-
local=True,
203-
vscode_debug=True,
201+
deployment, local=True, vscode_debug=True
204202
)
205203
```
206204

@@ -320,7 +318,7 @@ endpoint = ml_client.online_endpoints.get(name=endpoint_name, local=True)
320318
321319
request_file_path = "../model-1/sample-request.json"
322320
323-
endpoint.invoke(endpoint_name, request_file_path, local=True)
321+
ml_client.online_endpoints.invoke(endpoint_name, request_file_path, local=True)
324322
```
325323
326324
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:
@@ -336,8 +334,7 @@ In this case, `<REQUEST-FILE>` is a JSON file that contains input data samples f
336334
> 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`.
337335
>
338336
> ```python
339-
> endpoint = ml_client.online_endpoints.get(endpoint_name, local=True)
340-
> endpoint.as_dict()
337+
> print(endpoint)
341338
> ```
342339
>
343340
> The output should look similar to the following:
@@ -404,19 +401,22 @@ For more extensive changes involving updates to your environment and endpoint co
404401
new_deployment = ManagedOnlineDeployment(
405402
name="green",
406403
endpoint_name=endpoint_name,
407-
model=Model(path="../model-2/model"),
404+
model=Model(path="../model-2/model/sklearn_regression_model.pkl"),
408405
code_configuration=CodeConfiguration(
409406
code="../model-2/onlinescoring", scoring_script="score.py"
410407
),
411408
environment=Environment(
412-
conda_file="../model-2/environment/conda.yml",
409+
conda_file="../model-1/environment/conda.yml",
413410
image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1",
414411
),
415412
instance_type="Standard_DS2_v2",
416413
instance_count=2,
417414
)
418415
419-
ml_client.online_deployments.update(new_deployment, local=True, vscode_debug=True)
416+
417+
deployment = ml_client.online_deployments.begin_create_or_update(
418+
new_deployment, local=True, vscode_debug=True
419+
)
420420
```
421421
422422
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)