NaNsense
Don't guess why your neural network fails to learn. Instead, have a look inside.
https://github.com/user-attachments/assets/d7ee7ecc-4828-4655-866d-a220174c2b44
The main NaNsense UI: click layers to see activations and gradients, measure receptive fields, collect per-channel statistics, and run deep dream mid-training.
- 🕹️ Try the Playground — inspect a trained network in your browser, no install
- ✨ Integrate with one prompt — a coding agent wires it into your training loop
- 🤖 Debug with a coding agent — it speaks MCP, so your agent can also debug your net
- 📚 Documentation — showcase, guides and the full Python API (also as llms.txt)
NaNsense is a PyTorch debugger that visualizes activations, gradients, weights, optimizer state and various statistics. You can pause, step batch-by-batch, and time-travel to a different epoch while training, and see exactly what every layer is doing.
Here's how NaNsense can help:
- See what is actually going on. Visualize activations and gradients, find image patches with minimal or maximal activation for a given channel, and simulate what each neuron is searching for (deep dream)
- Spot optimization bottlenecks. Discover insufficient receptive fields, measure neuron death, discover padding artifacts and spot gradient underflow
Unlike wandb or TensorBoard, which log external metrics (loss, accuracy) to scroll through after the run, NaNsense is about understanding the internals of the network. A logger tells you that the loss stopped falling; NaNsense shows you why — say, a layer's channels dying or fp16 gradients underflowing.
Try it
Clone the repository and run a bundled example with uv — Python, dependencies, datasets and pretrained networks download automatically, and a browser tab opens with the UI:
# Install uv (Windows: https://docs.astral.sh/uv/getting-started/installation):
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/kongaskristjan/nansense
cd nansense
# --group: cpu | cuda (NVIDIA) | cuda-legacy (pre-Turing NVIDIA) | rocm (AMD)
uv run --group cpu examples/standard/main.py --nansense-port 8080
Getting started lists all the examples and explains the hardware groups.
Use it in your project
pip install nansense
Wiring it into a training loop is a few lines of code: paste one prompt into your coding agent, or follow the Wiring guide yourself.
See INTERNALS.md for how it works under the hood (it's long).
Release files for nansense 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nansense-0.3.0.tar.gz | 2.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nansense-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.2 MB
Release files / nansense-0.3.0.tar.gz
| Download URL | nansense-0.3.0.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cf59e923588553cd551726addcffaaf029b0d5ca9471579c170b08be21eaa9d
|
|
BLAKE2b-256 checksum How to use checksums |
b86046786e8187414c5b7fe5cd4c09cbbc6e6bf067ee964539e857d37107cf91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.
Transparency logRelease files / nansense-0.3.0-py3-none-any.whl
| Download URL | nansense-0.3.0-py3-none-any.whl |
|---|---|
| Size | 378.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d655f66a4973370e614a8d6cc4e2dc5bbc7dc7723da262ac3769b4a9504810a
|
|
BLAKE2b-256 checksum How to use checksums |
6893171ab03f04b755065211f60b6e020c9e0a506c536296dc80da064088dfb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.
Transparency log