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.

Tags are visible in the ZenML Dashboard

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.

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 snapshots

Assigning tags to snapshots 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 snapshot 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:

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.

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.

ZenML Scarf

Last updated

Was this helpful?