Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Tensorflow Serving SavedModel Preparation

From Leeroopedia
Knowledge Sources
Domains Data_Preparation, Deployment
Last Updated 2026-02-13 17:00 GMT

Overview

A model acquisition process that obtains a pre-trained SavedModel from a model hub or custom training pipeline and organizes it into the versioned directory structure required by TensorFlow Serving.

Description

Before deployment, a SavedModel must be in the correct directory layout: <base_path>/<version_number>/saved_model.pb. Models can be sourced from:

  • TensorFlow Hub: Pre-trained models downloaded as compressed archives
  • Custom training: Models exported via SavedModelBuilder or tf.saved_model.save()
  • Model registries: Organizational model stores

The version number must be a positive integer. TensorFlow Serving discovers versions by scanning for integer-named subdirectories.

Usage

Use this as the first step in any Kubernetes deployment. The model must be prepared locally or in a shared filesystem before being baked into a Docker image.

Theoretical Basis

# Abstract model preparation (NOT real implementation)
# Option 1: Download from TF Hub
download(url="https://tfhub.dev/.../resnet_50/.../1", dest="/tmp/resnet.tar.gz")
extract(archive="/tmp/resnet.tar.gz", dest="/tmp/resnet/123/")

# Option 2: Export from training
model = train(data)
export(model, path="/tmp/resnet/123/")

# Result: /tmp/resnet/123/saved_model.pb + /tmp/resnet/123/variables/

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment