MachineLearningNotebooks
MachineLearningNotebooks copied to clipboard
AzureML Python SDK: Model deserialization ignores tags
Version azureml.core: 1.11.0
from azureml.core import Model
model = Model(ws, "MODEL_NAME")
tags_before_serialization = model.tags
serialized = model.serialize()
deserialized_model = Model.deserialize(ws, serialized)
tags_after_serialization = deserialized_model.tags
print(f"Before: {tags_before_serialization}")
print(f"After: {tags_after_serialization}")
Result:
Before: {'Fit': '0.601', 'BuildId': '271320'}
After: {}
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 1517f63f-2d2e-1539-060e-0a471c1c438a
- Version Independent ID: 9e466042-1059-b835-8c92-01e9d9858166
- Content: azureml.core.model.Model class - Azure Machine Learning Python
- Content Source: AzureML-Docset/stable/docs-ref-autogen/azureml-core/azureml.core.model.Model.yml
- Service: machine-learning
- Sub-service: core
- GitHub Login: @debfro
- Microsoft Alias: debfro
Workaround:
deserialized_model.update(tags=serialized["tags"])
Hey there, I am encountering a similar issue wherein the model is not registering the tags when calling the model.register method. This is problematic as I want to filter by the model tags downstream using Model.list. I have tried passing the tags parameter in model.register as well as calling model.add_tags after the model registration method.
model = Model.register(
workspace=ws,
model_name=model_name,
model_path=output_dir,
model_framework=Model.Framework.CUSTOM,
description="blah blah blah",
tags={'foo':'bar'}
)
model.add_tags({'green_eggs':'ham'})
Are there any workarounds here?