Azure / MachineLearningNotebooks

Python notebooks with ML and deep learning examples with Azure Machine Learning Python SDK | Microsoft
https://docs.microsoft.com/azure/machine-learning/service/
MIT License
4k stars 2.49k forks source link

Issue in downloading the latest version of a registered model through CLI #1881

Closed shishirdash24 closed 1 year ago

shishirdash24 commented 1 year ago

My requirement is to download the latest version of a registered model and also to extract the latest version number using Azure CLI. I am using 'az ml model download'. The available options in my terminal are totally different than the options shown in the training links from microsoft.

Options available in the terminal: $ az ml model download - --debug --only-show-errors --resource-group --workspace-name -o
--download-path --output --subscription -g -p
--help --query --verbose -h -v
--name --registry-name --version -n -w

Azure version in my terminal: $ az version { "azure-cli": "2.42.0", "azure-cli-core": "2.42.0", "azure-cli-telemetry": "1.0.8", "extensions": { "ml": "2.13.0" }

V2 CLI link--- https://learn.microsoft.com/en-us/cli/azure/ml/model?view=azure-cli-latest#az-ml-model-download az ml model download --name --version --workspace-name [--download-path] [--registry-name] [--resource-group]

V1 CLI link--- https://learn.microsoft.com/en-us/cli/azure/ml(v1)/model?view=azure-cli-latest#az-ml(v1)-model-download az ml model download --model-id --target-dir [--overwrite] [--path] [--resource-group] [--subscription-id] [--workspace-name] [-v]

The same is available in Azure SDK through MLClient. from azure.ai.ml import MLClient ml_client = MLClient( DefaultAzureCredential(), subscription_id, resource_group, workspace ) latest_model_version = max( [int(m.version) for m in ml_client.models.list(name = registered_model_name)] ) model = ml_client.models.get(name = registered_model_name, version = latest_model_version)