Use this file to discover all available pages before exploring further.
Pipelines are the core abstraction in ZenML. They define a sequence of steps that process data and produce artifacts. A pipeline is a directed acyclic graph (DAG) where each node represents a step.
You can make pipelines configurable by adding parameters:
from typing import Optional@pipelinedef training_pipeline( learning_rate: float = 0.001, epochs: int = 10, model_name: Optional[str] = None): """Configurable training pipeline. Args: learning_rate: Learning rate for model training epochs: Number of training epochs model_name: Optional name for the trained model """ data = load_training_data() model = train_model(data, learning_rate=learning_rate, epochs=epochs) if model_name: save_model(model, name=model_name)
Pipelines can return artifacts that are tracked by ZenML:
@pipelinedef simple_pipeline(name: Optional[str] = None) -> Annotated[str, "greeting"]: """Pipeline that returns a tracked artifact. Args: name: Optional name to personalize the greeting Returns: A greeting message as a tracked artifact """ greeting = simple_step(name=name) return greeting
Compose complex workflows by calling pipelines within pipelines:
@pipelinedef feature_engineering(): """Feature engineering pipeline.""" raw_data = load_raw_data() features = extract_features(raw_data) return features@pipelinedef training_pipeline(use_cached_features: bool = False): """Training pipeline that can reuse features.""" if use_cached_features: # Load features from previous run features = load_cached_features() else: # Run feature engineering features = feature_engineering() model = train_model(features) return model