15 TFX: MLOps and deploying models with TensorFlow

 

This chapter covers

  • Writing an end-to-end data pipeline using TFX (TensorFlow-Extended)
  • Training a simple neural network through the TFX Trainer API
  • Using Docker to containerize model serving (inference) and present it as a service
  • Deploying the model on your local machine so it can be used through an API

In chapter 14, we looked at a very versatile tool that comes with TensorFlow: the TensorBoard. TensorBoard is a visualization tool that helps you understand data and models better. Among other things, it facilitates

  • Monitoring and tracking model performance
  • Visualizing data inputs to models (e.g., images, audio)
  • Profiling models to understand their performance or memory bottlenecks

We learned how we can use the TensorBoard to visualize high-dimensional data like images and word vectors. We looked at how we can incorporate Keras callbacks to send information to the TensorBoard to visualize model performance (accuracy and loss) and custom metrics. We then analyzed the execution of the model using the CUDA profiling tool kit to understand execution patterns and memory bottlenecks.

15.1 Writing a data pipeline with TFX

15.1.1 Loading data from CSV files

15.1.2 Generating basic statistics from the data

15.1.3 Inferring the schema from data

15.1.4 Converting data to features

15.2 Training a simple regression neural network: TFX Trainer API

15.2.1 Defining a Keras model

15.2.2 Defining the model training

15.2.3 SignatureDefs: Defining how models are used outside TensorFlow

15.2.4 Training the Keras model with TFX Trainer

15.3 Setting up Docker to serve a trained model

15.4 Deploying the model and serving it through an API

15.4.1 Validating the infrastructure