Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LiteRT-LM Builder

Python tools for building, inspecting, and unpacking LiteRT-LM (.litertlm) container files.

Usage

The package provides two main Command Line Interfaces (CLIs): litert-lm-builder and litert-lm-peek.


🛠️ Build a LiteRT-LM File (litert-lm-builder)

Use litert-lm-builder to package various components into a single .litertlm file. There are two ways to use this tool:

Method 1: Build using a TOML Configuration

Specify all the components and metadata in a TOML file, then run:

litert-lm-builder toml --path config.toml output --path model.litertlm

Example TOML File (config.toml):

[system_metadata]
entries = [
  { key = "author", value_type = "String", value = "Authors" }
]

[[section]]
section_type = "LlmMetadata"
data_path = "path/to/llm_metadata.pb"

[[section]]
section_type = "SP_Tokenizer"
data_path = "path/to/sp.model"

[[section]]
section_type = "TFLiteModel"
model_type = "PREFILL_DECODE"
data_path = "path/to/model.tflite"
additional_metadata = [
  { key = "model_version", value_type = "String", value = "1.0.1" }
]

Method 2: Build via Command Line Arguments

You can construct the file by chaining subcommands in the terminal. The order of the subcommands determines the order of the sections in the generated file.

litert-lm-builder \
  system_metadata --str author "Authors" \
  llm_metadata --path path/to/llm_metadata.pb \
  sp_tokenizer --path path/to/sp.model \
  tflite_model --path path/to/model.tflite --model_type prefill_decode --str_metadata model_version "1.0.1" \
  output --path model.litertlm

Subcommands and Options Reference:

  • output (Required): Specifies the output file path.
    • --path PATH: Path to save the built .litertlm file.
  • toml: Load configuration from a TOML file.
    • --path PATH: Path to the .toml file.
  • system_metadata: Add global system metadata.
    • --str KEY VALUE: Add a string key-value pair (can be specified multiple times).
    • --int KEY VALUE: Add an integer key-value pair (can be specified multiple times).
  • llm_metadata: Add LLM-specific configuration.
    • --path PATH: Path to the LLM metadata (text or binary proto).
  • tflite_model: Add a TFLite model.
    • --path PATH: Path to the .tflite file.
    • --model_type TYPE: e.g., embedder, prefill_decode.
    • --backend_constraint BACKEND: (Optional) Backend constraint (e.g., gpu, cpu, npu).
    • --prefer_activation_type TYPE: (Optional) Preferred activation type (fp16, fp32, fp32_fp16).
    • --str_metadata KEY VALUE: (Optional) String metadata for this model section.
  • sp_tokenizer: Add a SentencePiece tokenizer.
    • --path PATH: Path to the .model file.
    • --str_metadata KEY VALUE: (Optional) String metadata.
  • hf_tokenizer: Add a Hugging Face tokenizer.
    • --path PATH: Path to the tokenizer.json file.
    • --str_metadata KEY VALUE: (Optional) String metadata.

🔍 Inspect and Unpack a LiteRT-LM File (litert-lm-peek)

Use litert-lm-peek to inspect the contents of a .litertlm file or extract all its packaged files.

litert-lm-peek --litertlm_file model.litertlm [options]

Options Reference:

  • --litertlm_file PATH (Required): The path to the .litertlm file to inspect.
  • --dump_files_dir PATH (Optional): The directory where all packaged files (models, tokenizers, weights) should be extracted/unpacked. If not provided, the tool will only print the metadata and section structures to the console without extracting files.

Metadata

Release files for litert-lm-builder-nightly 0.12.0.dev20260518

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for litert-lm-builder-nightly 0.12.0.dev20260518
File Interpreter ABI Platform
litert_lm_builder_nightly-0.12.0.dev20260518-py3-none-any.whl Python 3 none any Details

Release files / litert_lm_builder_nightly-0.12.0.dev20260518-py3-none-any.whl

Download URL litert_lm_builder_nightly-0.12.0.dev20260518-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab684578b172a3018f2d3edd2fdac5938316ced5555214c4182ed78a20765a9d
BLAKE2b-256 checksum
How to use checksums
d04dd5ca0107561848ebcac658c4add863490cc31b6edcb4fdf64f4e73f062b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page