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:Bentoml BentoML Model Export Import

From Leeroopedia
Principle Metadata
Principle Name Model Export Import
Workflow Model_Store_Management
Domain ML_Serving, Model_Management
Related Principle Principle:Bentoml_BentoML_Model_Persistence, Principle:Bentoml_BentoML_Model_Cloud_Sync
Implemented By Implementation:Bentoml_BentoML_Models_Export_Import
Last Updated 2026-02-13 15:00 GMT

Overview

Model Export Import is the principle of serializing model artifacts from the local store into portable file formats and restoring them back. This enables model sharing across environments, teams, and organizations without requiring a centralized registry like BentoCloud.

Core Concept

Exporting and importing model artifacts for portability and sharing decouples model distribution from any specific registry or cloud service. A model can be exported to a self-contained archive file, transferred via any mechanism (shared drive, email, CI artifact, cloud storage), and imported into a different BentoML installation.

Theory

Model export serializes a model from the local store into a portable file format (tar, gzip, xz, bzip2, zip, or folder). Import reverses this process, reconstructing the model in the target store with all its metadata intact.

Supporting remote protocols (S3, FTP, and other fsspec-compatible backends) enables direct integration with cloud storage and CI/CD pipelines. This provides:

  • Team Collaboration: Models can be shared between team members who may not have access to the same BentoCloud instance
  • Disaster Recovery: Exported models serve as backups that can be restored to any BentoML installation
  • CI/CD Integration: Models can be exported as build artifacts and imported in deployment pipelines
  • Air-Gapped Environments: Models can be transferred to environments without network access

Supported Formats

Format Extension Description
bentomodel .bentomodel Default BentoML archive format (tar-based)
gz .gz Gzip-compressed tar archive
xz .xz XZ-compressed tar archive
bz2 .bz2 Bzip2-compressed tar archive
tar .tar Uncompressed tar archive
zip .zip ZIP archive
folder (directory) Direct folder copy

Design Principles

Format Flexibility

Multiple archive formats accommodate different constraints. Compressed formats minimize transfer sizes, while the folder format enables direct inspection and modification of model artifacts.

Remote Protocol Support

Integration with fsspec enables direct export/import to/from remote storage systems:

# Export directly to S3
bentoml.models.export_model("my_model:latest", "s3://my-bucket/models/")

# Import from S3
bentoml.models.import_model("s3://my-bucket/models/my_model-v1.bentomodel")

Round-Trip Fidelity

The export/import cycle preserves all model information: artifact files, metadata, labels, creation time, framework context, and custom objects. An imported model is indistinguishable from the original in the store.

Self-Contained Archives

Each exported archive contains everything needed to reconstruct the model: the model.yaml descriptor, all artifact files, and any custom objects. No external dependencies or additional downloads are required for import.

Relationship to Other Principles

  • Model Persistence: Export operates on models that were previously persisted to the local store.
  • Model Cloud Sync: Export/import provides an alternative to push/pull for environments without BentoCloud access.
  • Model Versioning: Exported models retain their original tags, which are restored on import.

Knowledge Sources

Page Connections

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