Skip to main content

Inspect input and output metadata for common AI model formats.

Project description

model-inspect

A unified command-line tool for inspecting model input/output metadata.

Supported backends:

  • ONNX: native onnx parser
  • TFLite: tflite-runtime or TensorFlow Lite Interpreter
  • PyTorch: TorchScript by default; checkpoint loading only with explicit opt-in
  • TensorRT Engine: TensorRT Python API or trtexec
  • CVIModel/BModel: external model_tool --info
  • RKNN: best-effort external RKNN toolkit integration

Install

Core CLI:

pip install model-inspect-tool

Install common open-format backends:

pip install "model-inspect-tool[onnx,torch]"

On Linux, TFLite can often be installed with:

pip install "model-inspect-tool[tflite]"

Alternatively install TensorFlow:

pip install "model-inspect-tool[tensorflow]"

Vendor formats require their matching SDK/runtime:

  • TensorRT: NVIDIA TensorRT and/or trtexec
  • CVIModel: TPU-MLIR model_tool
  • RKNN: RKNN Toolkit2

Usage

Human-readable output:

model-inspect model.onnx

JSON output:

model-inspect model.onnx --json

Write JSON to a file:

model-inspect model.onnx --json --output report.json

Force a backend:

model-inspect unknown.bin --format onnx

Inspect an ordinary PyTorch checkpoint:

model-inspect model.pt --allow-unsafe-pickle

Warning: ordinary PyTorch checkpoints may use Python Pickle. Never enable --allow-unsafe-pickle for untrusted model files.

Output schema

{
  "format": "onnx",
  "path": "/absolute/path/model.onnx",
  "backend": "onnx",
  "inputs": [
    {
      "name": "images",
      "shape": [1, 3, 640, 640],
      "dtype": "float32"
    }
  ],
  "outputs": [],
  "dynamic": false,
  "metadata": {},
  "warnings": []
}

Development

python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev,onnx,torch]"
pytest
model-inspect tests/assets/example.onnx --json

Build

python -m build
python -m twine check dist/*

Security

The tool does not load arbitrary PyTorch Pickle checkpoints unless the user explicitly supplies --allow-unsafe-pickle. Vendor command execution uses argument arrays and does not invoke a shell.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_inspect_tool-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_inspect_tool-0.1.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file model_inspect_tool-0.1.0.tar.gz.

File metadata

  • Download URL: model_inspect_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for model_inspect_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ac8dd7dd1c52e38ed0ab15b6ec15be6baee95dfc0c5aa34afa037276b97aaf4
MD5 05aa53aca697ab1012dbd6a0ba7218b5
BLAKE2b-256 c1187ea99c495a5922f613431a810367ef81f0a03d5dd0d67e8067cac0014cd2

See more details on using hashes here.

File details

Details for the file model_inspect_tool-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for model_inspect_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fef0cb9c56fdd814df4581b37e05d48b77a1c9bd0d81c910704fc166943ed25d
MD5 57776b882a9712a63734de2db3d62094
BLAKE2b-256 bd45af8c620cef4228e37cb1f0e7996bff73babc50ea628489b18b2d3b205b10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page