Organize data with tags
Use tags to organize tags in ZenML.
Organizing and categorizing your machine learning artifacts and models can streamline your workflow and enhance discoverability. ZenML enables the use of tags as a flexible tool to classify and filter your ML assets.

Tagging different entities
Assigning tags to artifacts
You can tag artifact versions by using the add_tags
utility function:
Alternatively, you can tag an artifact by using CLI as well:
Assigning tags to artifact versions
In order to tag an artifact through the Python SDK, you can use either use
the ArtifactConfig
object:
or the add_tags
utility function:
Moreover, you can tag an artifact version by using the CLI:
In the upcoming chapters, you will also learn how to use an cascade tag to tag an artifact version as well.
Assigning tags to pipelines
Assigning tags to pipelines is only possible through the Python SDK and you can use the add_tags
utility function:
Assigning tags to runs
To assign tags to a pipeline run in ZenML, you can use the add_tags
utility function:
Alternatively, you can use the same function within a step without specifying any arguments, which will automatically tag the run:
You can also use the pipeline decorator to tag the run:
Assigning tags to models and model versions
When creating a model version using the Model
object, you can specify tags as key-value pairs that will be attached to the model version upon creation.
During pipeline run a model can be also implicitly created (if not exists), in such cases it will not get the tags
from the Model
class.
You can also assign tags when creating or updating models with the Python SDK:
To add tags to existing models and their versions using the ZenML CLI, you can use the following commands:
Assigning tags to run templates
Assigning tags to run templates is only possible through the Python SDK and you can use the add_tags
utility function:
Advanced Usage
ZenML provides several advanced tagging features to help you better organize and manage your ML assets.
Exclusive Tags
Exclusive tags are special tags that can be associated with only one instance of a specific entity type within a certain scope at a time. When you apply an exclusive tag to a new entity, it's automatically removed from any previous entity of the same type that had this tag. Exclusive tags can be used with:
One pipeline run per pipeline
One run template per pipeline
One artifact version per artifact
The recommended way to create exclusive tags is using the Tag
object:
Alternatively, you can also create an exclusive tag separately and use it later:
The exclusive
parameter belongs to the configuration of the tag and this information is stored in the backend. This means, that it will not lose its exclusive
functionality even if it is being used without the explicit exclusive=True
parameter in future calls.
Cascade Tags
Cascade tags allow you to associate a tag from a pipeline with all artifact versions created during its execution.
When this pipeline runs, the cascade_tag
will be automatically applied to all artifact versions created during the pipeline execution.
Unlike the exclusive
parameter, the cascade
parameter is a runtime configuration and does not get stored with the tag
object. This means that the tag will not have its cascade
functionality if it is not used with the cascade=True
parameter in future calls.
Filtering
ZenML allows you to filter taggable objects using multiple tag conditions:
The example above shows how you can use multiple tag conditions to filter an entity. In ZenML, the default logical operator is AND
, which means that the entity will be returned only if there is at least one tag that matches all the conditions.
Removing Tags
Similar to the add_tags
utility function, you can use the remove_tags
utility function to remove tags from an entity.

Last updated
Was this helpful?