liveBook · Manning

Chapter 9: Model training and validation: Part 2

What you will learn in chapter 9 of Machine Learning Platform Engineering

The chapter introduces production-oriented ways to manage pipeline data, observe training, and trace model versions in the ID card detection and movie recommendation projects.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces production-oriented ways to manage pipeline data, observe training, and trace model versions in the ID card detection and movie recommendation projects.

Key terms: Kubernetes PersistentVolumes, PVs, Kubeflow Pipelines Kubernetes SDK, TensorBoard, MLflow, lineage, experiment tracking, model versioning, asynchronous observability

9.1 Storing data with PersistentVolumeClaim

This section introduces shared Kubernetes storage as a way to avoid repeated dataset downloads in Kubeflow pipelines and outlines how the pipeline will manage that storage.

Key terms: PersistentVolumeClaim, PVC, MinIO, Kubeflow pipelines, PersistentVolumeClaims component, mount

9.1.1 Refactoring the pipeline with a PVC

The section identifies redundant dataset downloads in the existing pipeline as the problem motivating a refactor.

Key terms: Download dataset component, Train model component, Validate model component, training, validation, and test dataset split

9.1.2 Efficient dataset management

This section explains why the pipeline should download a large dataset once and share it through a PVC rather than repeatedly accessing MinIO.

Key terms: dataset, PV, training and testing, MinIO, POSIX, PVC, VolumeOp, createpvc

9.1.3 Creating a VolumeOp

This section shows how to create a pipeline PVC with a VolumeOp before a downstream component uses it.

Key terms: VolumeOp, Pipeline PVC, ReadWriteOnce, storage classes

9.1.4 Download Op using PVC

This section shows how to mount a previously created PVC in a download component and write the dataset directly to it instead of using MinIO code.

Key terms: kfp.kubernetes.mount_pvc(), PVC, mount point, download_dataset(), MinIO, problem statement, model type, infrastructure limitations

9.1.5 Splitting the dataset directly

The section shows how to split a downloaded dataset on a shared PVC, explicitly ordering the split after the download and moving files into split folders.

Key terms: PVC, split_dataset_op, .after(download_op), Artifacts, VolumeOp, images, labels

9.1.6 Simplifying model training

Mounting the dataset PVC simplifies the model-training component by removing dataset downloads and path arguments while retaining YAML creation and model training.

Key terms: PVC, mount_pvc, train_model_op, train_model, InputPath, MinIO

9.1.7 Simplifying model validation

This section simplifies model validation by loading model weights from a mounted PVC instead of using MinIO-related code.

Key terms: PersistentVolumeClaim, PVC, validate_model_op, validate_model, weights_path, mount point

9.2 Tracking training with TensorBoard

The section explains why TensorBoard complements MLflow for training visibility and how the object detection pipeline must expose YOLOv8 logs to Kubeflow’s TensorBoard.

Key terms: MLflow, TensorBoard, training metrics, training runs, YOLOv8, Kubeflow, VolumeOp, mount point, project directory

9.2.1 Launching a new TensorBoard

This section walks through launching a Kubeflow TensorBoard using the PVC from an existing training pipeline run.

Key terms: create-pvc, PVC, pvc_name, training logs, TensorBoards, New TensorBoard, PVC Name, Mount Path, CREATE, CONNECT

9.2.2 Exploring YOLOv8’s default graphs

This section shows how to use TensorBoard’s YOLOv8 graphs to assess training performance and inspect the model’s architecture.

Key terms: TensorBoard, YOLOv8, mean Average Precision (mAP), training epochs, model architecture, data flow, layers, connections

9.3 Movie recommender project

This section introduces a movie recommender training workflow that builds on prepared data, rechecks its quality, tracks experiments and model versions, and tests recommendations in a notebook.

Key terms: Parquet files, MinIO bucket, train, test, and validation splits, quality assurance, data ingest and transform pipelines, training and evaluation pipelines, model training component, metrics for evaluation, MLflow, model versions

9.3.1 Reading data from MinIO and quality assurance

The section introduces a MinIO data-quality check for the movie recommender and compares reading data directly from MinIO with copying it to a shared volume before training.

Key terms: MinIO, data quality assessment (QA), schema, data types, shared VolumeOp, local volume, network access, TTL_SECONDS_AFTER_WORKFLOW_FINISH, ml-pipeline-persistenceagent, VolumeOps

9.3.2 Model training component

This section introduces the movie recommender’s simple PyTorch model and describes its training and testing loops.

Key terms: matrix factorization, PyTorch, user embeddings, item embeddings, hidden layers, training loop, batched input, testing loop, iteration

9.3.3 Metrics for evaluation

This section defines three example metrics for evaluating a movie recommender and explains why evaluation metrics must reflect business goals.

Key terms: evaluation metrics, business goals, stakeholders, toy metrics, precision, recall, true positives, false positives, false negatives, top 50 recommendations

9.3.4 Experiment tracking with MLflow

This section integrates MLflow into movie-recommender training and validation so teams can trace, retrieve, and compare model runs.

Key terms: experiment tracking, MLflow, TensorBoard, model lineage, model artifact storage, proxied access mode, MLflow tracking server, storage backends, hyperparameters, optimizer

9.3.5 Model registry with MLflow

This section explains how MLflow’s model registry turns logged recommender models into versioned, traceable models that can be promoted through staging toward production.

Key terms: model registry, model versions, model lineage, rollback, experiment run, registered model, model version, model alias, staging, production

9.3.6 Creating a pipeline from components

This section assembles the movie recommender components into a compiled Kubeflow pipeline and notes how to split a large pipeline into smaller ones.

Key terms: components, pipeline, compile, MLflow, MinIO, inputs, Kubeflow

9.3.7 Local inference in a notebook

The section uses notebook inference to check a registered movie recommender against a user’s viewing history, then connects that check to the broader training pipeline and upcoming production serving work.

Key terms: model registry APIs, input and output tensors, recommend method, local inference, local inference testing, recommendations, viewing history, user 50, ETL, MinIO

9.4 Summary

The chapter summary explains how persistent storage, experiment tracking, and accessible model artifacts make training more efficient and evaluation easier to improve.

Where this is used later

Concepts explained in this chapter

← Chapter 8: Model training and validation: Part 1 Chapter 10: Model inference and serving →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.