How to deploy multiple ml models with scoring file using azure ml cli

478 Views Asked by At

I'm trying to deploy the Multiple azure ml models from workspace with scoring script file but i'm unable to deploy 2 models with azure ml cli

 az ml model deploy --name multi-model --model '[model1:9,model2:1]' --compute-target 'aks-cpu' --ic inferenceConfig.json -e 'inferen
ce-env' --ev 6 --dc aksDeploymentConfig.json -g 'Workspace' --workspace-name 'MLWorkspace' --as true --mi 1 --ma 2 --overwrite -v

But got error: {'Azure-cli-ml Version': '1.41.0', 'Error': WebserviceException: Message: ModelNotFound: Model with id [model1:9,model2:1] not found in provided workspace InnerException None ErrorResponse { "error": { "message": "ModelNotFound: Model with id [model1:9,model2:1] not found in provided workspace" } }}

But i'm able to deploy single model without issue For multi-models, i am able to do with python without any issue i.e.,

aks_service_name='modelsvc' 
aks_service = Model.deploy(ws,
models=[model1,model2],
inference_config=inference_config,
deployment_config=gpu_aks_config,
deployment_target=aks_target,
name=aks_service_name,overwrite=True)

aks_service.wait_for_deployment(show_output=True)

Can anyone provide insight on this?

1

There are 1 best solutions below

0
On
{'Azure-cli-ml Version': '1.41.0', 'Error': WebserviceException: Message: ModelNotFound: Model with id [model1:9,model2:1] not found in provided workspace InnerException None ErrorResponse { "error": { "message": "ModelNotFound: Model with id [model1:9,model2:1] not found in provided workspace" } }}

The above-mentioned error is due to two reasons.

  • The models were not available in the workspace created.

Creating workspace using CLI

az group create -n myresourcegroup -l westus2

az ml workspace create -w myworkspace -g myresourcegroup

az ml folder attach -w myworkspace -g myresourcegroup

for deploying multiple models using azure ML CLI, we need to use “-m” with the model’s name. We cannot add them into the workspace, as list element without mentioning “-m”. --model -m : is the tag we need to add after the model's name

az ml model deploy --name multi-model --model -m '[model1:9,model2:1]' --compute-target 'aks-cpu' --ic inferenceConfig.json -e 'inference-env' --ev 6 --dc aksDeploymentConfig.json -g 'Workspace' --workspace-name 'MLWorkspace' --as true --mi 1 --ma 2 --overwrite -v