@@ -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
115115Set up variables for the workspace and endpoint:
@@ -164,7 +164,7 @@ Azure Machine Learning local endpoints use Docker and VS Code development contai
164164Get a handle to the workspace:
165165
166166``` python
167- credential = AzureCliCredential ()
167+ credential = DefaultAzureCredential ()
168168ml_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`
179179deployment = 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
194194deployment = 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
315313request_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
320318In 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
398395new_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
416415Once 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