 a pipeline or a step level, or via a YAML config.Once you configure a pipeline this way, all artifacts generated during pipeline runs are automatically linked to the specified model. This connecting of artifacts provides lineage tracking and transparency into what data and models are used during training, evaluation, and inference.

from zenml import pipeline

from zenml import Model

model = Model(

# The name uniquely identifies this model

# It usually represents the business use case

name="iris_classifier",

# The version specifies the version

# If None or an unseen version is specified, it will be created

# Otherwise, a version will be fetched.

version=None,

# Some other properties may be specified

license="Apache 2.0",

description="A classification model for the iris dataset.",

# The step configuration will take precedence over the pipeline

@step(model=model)

def svc_trainer(...) -> ...:

...

# This configures it for all steps within the pipeline

@pipeline(model=model)

def training_pipeline(gamma: float = 0.002):

# Now this pipeline will have the `iris_classifier` model active.

X_train, X_test, y_train, y_test = training_data_loader()

svc_trainer(gamma=gamma, X_train=X_train, y_train=y_train)

if __name__ == "__main__":

training_pipeline()

# In the YAML the same can be done; in this case, the

#  passing to the decorators is not needed

# model:

# name: iris_classifier

# license: "Apache 2.0"

# description: "A classification model for the iris dataset."

The above will establish a link between all artifacts that pass through this ZenML pipeline and this model. This includes the technical model which is what comes out of the svc_trainer step. You will be able to see all associated artifacts and pipeline runs, all within one view.

Furthermore, this pipeline run and all other pipeline runs that are configured with this model configuration will be linked to this model as well.

You can see all versions of a model, and associated artifacts and run like this: