Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.63k stars 2.84k forks source link

Unable to download a trained model using azure-ai-ml version 1.22.2 #38609

Closed MrKriss closed 17 hours ago

MrKriss commented 2 days ago

Describe the bug Unable to download a trained model using the python SDK. The following error is raised in the SDK internals

AttributeError("'SasDatastoreSecrets' object has no attribute 'key'")

To Reproduce Steps to reproduce the behavior:

  1. Train a model using azure-ai-ml version 1.22.2
  2. Connect to the workspace and create a MLClient object.
  3. Call client.models.download(...) giving the details of the just trained model.

Expected behavior The model is downloaded successfully

Screenshots The traceback is shown below

Encountered exception during execution: AttributeError("'SasDatastoreSecrets' object has no attribute 'key'")
Traceback (most recent call last):
  File "/opt/python/packages/my_package/inference.py", line 31, in download_model
    aml.client.models.download(
  File "/opt/python/packages/azure/ai/ml/_telemetry/activity.py", line 292, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/operations/_model_operations.py", line 404, in download
    ds = self._datastore_operation.get(ds_name, include_secrets=True)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/_telemetry/activity.py", line 292, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/operations/_datastore_operations.py", line 163, in get
    return Datastore._from_rest_object(datastore_resource)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/entities/_datastore/datastore.py", line 191, in _from_rest_object
    res_abd: Datastore = AzureBlobDatastore._from_rest_object(datastore_resource)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/entities/_datastore/azure_storage.py", line 207, in _from_rest_object
    credentials=from_rest_datastore_credentials(properties.credentials),  # type: ignore[arg-type]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/entities/_datastore/utils.py", line 53, in from_rest_datastore_credentials
    config_class._from_datastore_rest_object(rest_credentials),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/packages/azure/ai/ml/entities/_credentials.py", line 130, in _from_datastore_rest_object
    return cls(account_key=obj.secrets.key if obj.secrets else None)
                           ^^^^^^^^^^^^^^^
AttributeError: 'SasDatastoreSecrets' object has no attribute 'key'

Additional context

github-actions[bot] commented 2 days ago

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