Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Tensorflow Serving Hashmap Servable

From Leeroopedia
Knowledge Sources
Domains Model Serving, Servable Loading, Key Value
Last Updated 2026-02-13 00:00 GMT

Overview

Hashmap Servable defines the pattern for serving non-TensorFlow data types through the TensorFlow Serving source adapter framework, using simple key-value hashmaps as a reference implementation.

Description

The Hashmap Servable principle demonstrates how the TensorFlow Serving framework can be extended beyond TensorFlow models to serve arbitrary data types. By implementing a SimpleLoaderSourceAdapter, any data type that can be loaded from a filesystem path can be managed as a versioned servable with automatic lifecycle management.

Design principles:

  • Generic adapter pattern: SimpleLoaderSourceAdapter<StoragePath, DataType> provides a template for loading any data type from a path.
  • Configuration-driven parsing: The file format is specified in configuration, allowing different serialization formats to be supported.
  • Lifecycle management: The adapter integrates with the standard source/manager infrastructure for version management and resource tracking.
  • Clean teardown: Detach() is called in the destructor to properly disconnect from sources before destruction.

Usage

Apply this principle when adding non-TensorFlow servable types to TensorFlow Serving. Use the hashmap adapter as a template: implement a SimpleLoaderSourceAdapter with a load function that reads from a path and produces the desired data type.

Theoretical Basis

The hashmap servable implements the Adapter pattern, converting the serving framework's source interface (storage paths) into a domain-specific data type (hashmaps). The SimpleLoaderSourceAdapter template provides a reusable bridge that handles the boilerplate of Loader creation, allowing implementors to focus solely on the data loading logic. This demonstrates the framework's extensibility beyond its primary TensorFlow model serving use case.

Related Pages

Page Connections

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