A sub-100ms, zero-dependency CLI tool to inspect ML model checkpoints and dynamically calculate VRAM requirements.
Project description
ModelInfo CLI
ModelInfo is a terminal-native utility that inspects machine learning model checkpoints (.safetensors, .gguf, .pt) and calculates hardware requirements completely offline.
It reads binary headers directly using the Python standard library. By bypassing full tensor payload loading and strictly excluding heavy ecosystems like PyTorch or HuggingFace, the tool executes in under 100 milliseconds.
Features
- Zero-Dependency Parsing: Reads the 8-byte JSON prefix of
.safetensorsfiles and the binary key-value metadata of.ggufdirectly viastructandjson. - Sharded Model Support: Transparently parses
model.safetensors.index.jsonto detect multi-file checkpoint distributions, gracefully guarding against partial downloads without crashing. - Dynamic VRAM Estimation: Extracts underlying model architecture (layers, heads, dimensions) to calculate exact VRAM limits, including dynamic KV cache footprints based on user-specified context lengths.
- Precise Block Quantization: Factors in exact byte-scaling coefficients for GGUF formats (e.g., Q8, Q6, Q4) rather than naive averages, eliminating VRAM under-reporting.
- Secure Pickling: Inspects legacy
.ptfiles without executing arbitrary code by using a highly restrictedpickle.Unpickler. - Terminal UI: Groups repetitive structural layers and color-codes VRAM heatmaps using
rich.
Installation
Install directly from PyPI:
pip install modelinfo-cli
Development
To install from source and run the test suite:
git clone https://github.com/pipe1os/modelinfo-cli.git
cd modelinfo-cli
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Testing
The testing suite enforces cross-platform structural integrity and guards the zero-dependency latency constraint. Tests are isolated against custom binary mocks in tests/fixtures/.
Run the test suite using pytest:
pytest tests/ -v
Usage
Inspect a model checkpoint:
modelinfo mistral-7b.safetensors
Calculate the memory footprint with a specific KV cache context window:
modelinfo mistral-7b.safetensors --context 8192
Example Output
Format: SafeTensors
Architecture: Mistral (32 transformer layers)
Tensors: 291
Parameters: 7.2B
Dtype: bf16
Disk size: 13.49 GB
VRAM (est): ~15.2 GB (bf16, KV cache for 8192 tokens)
Top Tensors by Size:
model.embed_tokens.weight [32000 x 4096] bf16 131.1M params
32x model.layers.[N].self_attn.q_proj.weight [4096 x 4096] bf16 16.8M params
Architecture
The system operates across three modules:
- Presentation (
cli.py,ui.py): Parses arguments and formats tables viarich. - Parsing Engine (
parsers/): Specialized binary readers (safetensors.py,gguf.py,pytorch.py) strictly confined to standard library operations. - Math Engine (
calculator.py): Determines total parameter counts, maps data types to byte coefficients, and calculates dynamic memory allocations based on tensor shape heuristics.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modelinfo_cli-1.0.0.tar.gz.
File metadata
- Download URL: modelinfo_cli-1.0.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48e34a22b87c2fe45653df433533a1ba83936eb255656184bd72916d7be585a5
|
|
| MD5 |
4a8c753865f953f08e74ab666a1ac521
|
|
| BLAKE2b-256 |
c0036e2789ff302ad67f8e4f6ecf5f248aa9c7d70cc2edfe788ac314f70269ff
|
Provenance
The following attestation bundles were made for modelinfo_cli-1.0.0.tar.gz:
Publisher:
publish.yml on pipe1os/modelinfo-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modelinfo_cli-1.0.0.tar.gz -
Subject digest:
48e34a22b87c2fe45653df433533a1ba83936eb255656184bd72916d7be585a5 - Sigstore transparency entry: 1723555898
- Sigstore integration time:
-
Permalink:
pipe1os/modelinfo-cli@3260ba667081a3e85135b2cfcf1eb022afdca5fa -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/pipe1os
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3260ba667081a3e85135b2cfcf1eb022afdca5fa -
Trigger Event:
release
-
Statement type:
File details
Details for the file modelinfo_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: modelinfo_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
608c87ecb26cdd09ecad2a042b1e8c07dc0050cd0a7e86bcb8bf29f920dd558b
|
|
| MD5 |
13e20f050e8eb009172e0db10f6f0668
|
|
| BLAKE2b-256 |
7dea6a4294c51821df02fe86a85d0e97fe34096084ba4d4f955c8fd0caf13484
|
Provenance
The following attestation bundles were made for modelinfo_cli-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on pipe1os/modelinfo-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modelinfo_cli-1.0.0-py3-none-any.whl -
Subject digest:
608c87ecb26cdd09ecad2a042b1e8c07dc0050cd0a7e86bcb8bf29f920dd558b - Sigstore transparency entry: 1723556002
- Sigstore integration time:
-
Permalink:
pipe1os/modelinfo-cli@3260ba667081a3e85135b2cfcf1eb022afdca5fa -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/pipe1os
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3260ba667081a3e85135b2cfcf1eb022afdca5fa -
Trigger Event:
release
-
Statement type: