Skip to main content

Statistical model analysis for ML model weights.

Project description

weightlens

Weightlens is an analysis tool for checkpoint weights.

What it solves

  • Corruption detection (empty / partial failures, tensor access failures and NaN/zero floods)
  • Per-layer metrics (mean, std, min/max, L2 norm, sparsity and p99 absolute)
  • Global distribution stats which are streamed to prevent OOM and memory crashes.
  • deterministic diagnostics for unhealthy layers.

What's next?

  • Improve diagnostics by bucketing components and softening constraints (bias, weights, norm_params, etc.)
  • Integrate checkpoint diffing - compare regressions, drift, and training failures between two or more checkpoints
  • Extend Weightlens for h5, safetensors, joblib, etc.
  • Research on deeper failure modes and detecting them accurately.

Performance

File size of .pth Time taken
~ 200 MB ~ 6 seconds
~ 1.5GB ~ 16 seconds

To use

Simply run pip install weightlens into your virtual environment and start by running lens analyze <filename>.pth

Status

ALL TESTS AND LINT CHECKS PASS.

Contributing

  1. Step 0: Clone this repo.
  2. Step 1: Setup a virtual environment of your choice. The standard is uv as a requirements.txt does not exist here.
  3. Step 2: Run uv pip install -e .[dev]
  4. Step 3: Start contributing!

If you would like to contribute, please do create Pull Requests.

Final Notes

This was a weekend project to work on, but it solves a real frustration by shedding some light onto how model checkpoints fail all the time. This library is NOT perfect. I will work on it!

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

weightlens-0.1.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

weightlens-0.1.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: weightlens-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weightlens-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48748200569ab5ed253e16721ab139055970cde912b44bb2b571d7eb29a60037
MD5 9fbb2f625b6d92b3dcd5d1c5f934a44e
BLAKE2b-256 275b90205b0034e3ca80f6fa1d1ed57ed0b61ff6aba04835fddaeaf4ac034c06

See more details on using hashes here.

Provenance

The following attestation bundles were made for weightlens-0.1.0.tar.gz:

Publisher: publish.yml on akshathmangudi/weightlens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: weightlens-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for weightlens-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ec49cc0b84f4a498f3b663be75893e6d07ab6da88e9e6046be4e97dc7ac9b4f
MD5 816a6b36a9293d1b2d68b1c72222933c
BLAKE2b-256 2de5eb6188b5fe366100c5979bd8dfb80d5ce5bab6fbff1083e04abe10d1d0c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for weightlens-0.1.0-py3-none-any.whl:

Publisher: publish.yml on akshathmangudi/weightlens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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