Description
I have an azure machine learning managed online deployment. I'm working fully locally for now and I see that there is an error when using only local. Let's have for this example no endpoints and no deployments created in azure ml.
When I try to invoke the local endpoint using the OnlineEndpointOperations
(MLClient.online_endpoints). I get an error because it tries to validate the deployment name.
- I see an easy fix for this as only validate the deployment name if it's an online endpoint and not doing it if local=True.
The correct solution would be fixing the function _validate_deployment_name
to accept the local=local
as parameter. The problem here is that inside this function there is no easy way to get the deployments_list for local unless the _LocalDeploymentHelper
is instantiated.
Now in the code I have I have a monkey patch in order to skip the validation and then I can do the invoke like this:
online_endpoints_operator = ml_client.online_endpoints
if local_deploy:
online_endpoints_operator._validate_deployment_name = (
lambda *args, **kwargs: True
)
online_endpoints_operator.invoke(
endpoint_name=endpoint_name,
deployment_name=deployment_name,
local=local_deploy,
request_file=f"{model_score_path}/{model_sample_input}",
)