Two Safetensors Tools for Inspecting Weights and Quantization
Puppet_Master_1337 · reddit · 2026-07-15
The author developed two tools to help understand safetensors and quantization, sharing their use cases and outputs.
1) modelexplorer.py
This tool organizes model tensors into a hierarchical tree view:
- Aggregates layers with the same name and shape
- Sorts the largest layers to the top
- Leaf nodes display dtype and shape
- Supports both local files and Hugging Face files (downloading only the header without pulling the entire model)
- Currently supports newer quantization formats like NVFP4 and INT4
In the author's example, a Krea 2 weight file is broken down into a hierarchy, showing exactly how much space various blocks, MLPs, gates, and weight scales consume, along with their dtypes.
2) quantexplorer.py
This tool compares a base model with its quantized version, automatically identifying which tensors are:
- Quantized
- Kept at their original dtype (blacklisted)
- Downcasted to lower precision
It also deduces naming patterns from the results. In the author's example:
- blocks..attn. and blocks..mlp. are quantized
- scale-related tensors are kept
- Several patterns are downcasted from f32 to bf16
The author has open-sourced the project on GitHub under the MIT license and welcomes contributions; some of the code was written with the assistance of an LLM.
More from Infra
- Two-hour workshop covers open models, benchmark cheating, reward hacking and quantization — danielhanchen · 2026-07-21
- Nativ brings local AI model running to Mac with a desktop app and localhost API — Simon Willison · 2026-07-21
- Octen says agent search now runs at 62ms P50 with only a 6ms P90 gap — aakashgupta · 2026-07-21
- Zhipu acquires a compiler-team spinout to optimize AI inference on domestic chips — zephyr_z9 · 2026-07-21
- Open reproduction of Meta’s REWIRE data pipeline cuts the cost to about $11 — vanstriendaniel · 2026-07-21
- NeurIPS 2026 workshop will focus on on-device intelligence and local execution — YiMaTweets · 2026-07-21