Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
379 stars 1.19k forks source link

azure cli ml command throw "Invalid AzureML ARM versioned Id azureml" error #7214

Open TaherehFarrokhiWTW opened 7 months ago

TaherehFarrokhiWTW commented 7 months ago

Describe the bug

I'm trying to package a model using the guide described here https://learn.microsoft.com/en-us/azure/machine-learning/how-to-package-models?view=azureml-api-2&tabs=cli#package-a-model-that-is-hosted-in-a-registry

The command I'm trying to run is

$MODEL_NAME = "model_name"
$MODEL_VERSION = "1"
$REGISTRY_NAME = "registry_name
az ml model package --name $MODEL_NAME --version $MODEL_VERSION --registry-name $REGISTRY_NAME --file packagemodel.yaml --debug

In the middle of run, I get cli.azure.cli.core.azclierror: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/<workspace_id>/environments/mlmodel-pkg

The model name is already available in the workspace. I've checked the version of the az cli and az cli ml and both are the latest version

Related command

$MODEL_NAME = "model_name" $MODEL_VERSION = "1" $REGISTRY_NAME = "registry_name az ml model package --name $MODEL_NAME --version $MODEL_VERSION --registry-name $REGISTRY_NAME --file packagemodel.yaml --debug

Errors

cli.azure.cli.core.azclierror: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces//environments/mlmodel-pkg

Issue script & Debug output

I can't share all of it because of environment identifiers. Here is the part for the error:

Traceback (most recent call last): File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\custom\model.py", line 239, in ml_model_package model = ml_client.models.package(name=name, package_request=model_pack, version=version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_utils_experimental.py", line 100, in wrapped return func(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_telemetry\activity.py", line 275, in wrapper return f(*args, *kwargs) ^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml\operations_model_operations.py", line 780, in package parsed_id = AMLVersionedArmId(environment_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_utils_arm_id_utils.py", line 65, in init raise ValidationException( azext_mlv2.manual.vendored_curated_sdk.azure.ai.ml.exceptions.ValidationException: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/xxxx/environments/mlmodel-pkg cli: None cli: Traceback (most recent call last): File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\custom\model.py", line 239, in ml_model_package model = ml_client.models.package(name=name, package_request=model_pack, version=version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_utils_experimental.py", line 100, in wrapped return func(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_telemetry\activity.py", line 275, in wrapper return f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml\operations_model_operations.py", line 780, in package parsed_id = AMLVersionedArmId(environment_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\vendored_curated_sdk\azure\ai\ml_utils_arm_id_utils.py", line 65, in init raise ValidationException( azext_mlv2.manual.vendored_curated_sdk.azure.ai.ml.exceptions.ValidationException: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/xxxxx/environments/mlmodel-pkg

cli.azure.cli.core.azclierror: Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "C:\Users\userx.azure\cliextensions\ml\azext_mlv2\manual\custom\model.py", line 242, in ml_model_package ndored_curated_sdk\azure\ai\ml_utils_arm_id_utils.py", line 65, in init raise ValidationException( azext_mlv2.manual.vendored_curated_sdk.azure.ai.ml.exceptions.ValidationException: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/xxxx/environments/mlmodel-pkg

cli.azure.cli.core.azclierror: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/xxxx/environments/mlmodel-pkg az_command_data_logger: Invalid AzureML ARM versioned Id azureml://locations/westeurope/workspaces/xxxx/environments/mlmodel-pkg cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x00000201D865A3E0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 6.715 seconds (init: 0.365, invoke: 6.349) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3983 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\Users\userx.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

Expected behavior

To create the environment

Environment Summary

"azure-cli": "2.56.0", "azure-cli-core": "2.56.0", "azure-cli-telemetry": "1.1.0", "extensions": { "account": "0.2.5", "containerapp": "0.3.46", "ml": "2.22.0" }

Additional context

In the same guideline, the following command to get the version for the model throws the error:

MODEL_NAME="t5-base"
MODEL_VERSION=$(az ml model show --name $MODEL_NAME --label latest --registry-name azureml | jq .version -r)

The term 'jq' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct | and try again.

yonzhan commented 7 months ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 7 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github.

microsoft-github-policy-service[bot] commented 7 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github.