Azure / Azure/azure-sdk-for-python
Empty tags dictionary in ModelOperations.list() response
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: `azure-ai-ml`
- **Package Version**: 1.26.3
- **Operating System**: Debian 6.1.133-1
- **Python Version**: 3.11.10
**Describe the bug**
[`ModelOperations.list()`](https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.modeloperations?view=azure-python#azure-ai-ml-operations-modeloperations-list) (note that `name` argument is not provided), returns an iterable of models, which `tags` attribute is always an empty dictionary.
**To Reproduce**
Steps to reproduce the behavior:
```
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
client = MLClient(
credential=DefaultAzureCredential(),
subscription_id="",
resource_group_name="",
workspace_name="",
)
# tags attribute of every model in models is an empty dictionary
models = client.models.list()
```
Since the issue is caused by underlying REST API call, one call also reproduce it by calling [this endpoint](https://learn.microsoft.com/en-us/rest/api/azureml/model-containers/list?view=rest-azureml-2024-10-01&tabs=HTTP).
**Expected behavior**
[`ModelOperations.list()`](https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.modeloperations?view=azure-python#azure-ai-ml-operations-modeloperations-list) returns a iterable of models with tags included.
**Additional context**
Interestingly, [the corresponding API in Python SDK v1](https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.core.model.model?view=azure-ml-py#azureml-core-model-model-list.) which used `/modelmanagement/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/models` endpoint returns a list of models with tags.
I'd like to switch to SDK v2, since [v1 it's getting deprecated next year](https://learn.microsoft.com/en-us/azure/machine-learning/concept-v2?view=azureml-api-2#sdk-v2), but this bug makes the switch impossible.
An alternative approach with multiple `ModelOperations.get(name="somename")` calls (which return all the tags) is not acceptable, since I'm operating on thousands of models.
Contributor guide
Assessment
This issue has not been assessed yet.