Repository navigation
Releases: CLVwp/Neural_Network_Visualizer
Release list
v0.5.0 — Transformers and LLMs
New features
- HuggingFace parser. It reads
config.jsonand the safetensors header. No torch needed. - Header-only parsing. A 27B checkpoint opens in about six seconds. The tool never reads the full file.
- INT4 checkpoints work. Packed weights show their true sizes.
- BF16 and FP16 tensors get honest histograms. Small tensors only, with a size cap.
- Transformer blocks draw as a repeated sequence along one axis.
- Attention heads draw as small nodes under the output projection. Each head receives q, k, and v. Each head emits one
attendsedge. - Path view. Click a neuron, then press T. One unit lights up through all open layers.
- Layer-of-detail. Models above 20 000 neurons open with layers folded. Double-click a layer to open it.
- Top bar. Fold all, unfold all, jump to any layer, and stretch the horizontal axis.
- Load from disk. Type a model folder path in the page. The server reads the disk itself: no upload and no size limit.
- Context UI. Run shows only for a runnable PyTorch model. The image input shows only for conv models.
Install
pip install -e .
nnviz model.pth # PyTorch or ONNX file
nnviz llama_folder/ # HuggingFace folder: config.json + safetensors
nnviz serve # drag & drop, or type a folder path in the page
nnviz live model.pth # live mode: run the model, watch activations
Design note
The parser never loads a full checkpoint. It reads the safetensors header, then maps single tensors, under a size cap, for histograms. Quantized tensors carry no histogram: packed integers give no honest distribution. Zero new dependencies. The parser needs no torch.
Fixed
- A big model crashed the viewer on load. The collapse message ran before the toast element existed.
Known limits
- Drag & drop rejects files above 2 GiB. Type the folder path in the page instead. Or run
nnviz load <folder>. - A bare safetensors upload shows no heads. The head count lives in config.json, which the upload does not carry.
- Live mode needs a full PyTorch nn.Module. HuggingFace graphs load and draw, but they cannot run.
- Vision towers (VLMs) are skipped. Branch layout is the v0.6 roadmap.
- Head counts above 64 draw as attributes, not nodes.
- Every layer and head is its own draw call. A fluidity pass is planned for v0.8.
v0.4.0 — See it think (live mode)
See a network think. Load a full PyTorch model, run one forward pass, and watch the activations flow through the graph.
New features
- New command:
nnviz live model.pth. It loads a full PyTorch model. The page opens with the graph already drawn. - Run button: one forward pass with random input. Neurons light up layer by layer, like a wave. Intensity follows the activation value. The glow fades after about one second.
- Image input: feed a picture to a CNN. The tool resizes and normalizes it. Pillow does the decode.
- Output panel: top 8 classes with probability bars. The arrow marks the prediction.
- Input size probe: the server tries common input sizes until one works. One forward pass takes milliseconds.
Install
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install pillow # only for image input in live mode
pip install -e .
nnviz live model.pthDesign note
The roadmap said FastAPI and WebSocket. One forward pass is fast and atomic. One HTTP request returns all activations. The viewer animates the wave itself. So v0.4 stays on the stdlib server, with zero new dependencies. True streaming arrives with token-by-token LLMs.
Known limits
- Live mode runs PyTorch
nn.Modulefiles only. Astate_dictshows the graph but cannot run. - ONNX models do not run in live mode yet.
onnxruntimesupport is planned. - Activation vectors are capped at 4096 values per layer on the wire.
- The input probe tries common sizes. If your model needs an odd size, feed an image of the trained size.
Full changelog: v0.3.0...v0.4.0
v0.3.0 — Make weights visible
Weights are now part of the picture.
New
- Weight beams. Connections draw as beams. Thickness and color follow the weight magnitude. Wiring is truthful: pass-through ops (ReLU, Pool, Flatten) map neuron i to neuron i. Weighted layers (Conv, Linear) read every input, drawn as sampled bipartite fans.
- Per-neuron detail. Neurons glow by their incoming |w|. Click a neuron for its index, |w|, and rank. Click a layer for its weight histogram and stats.
- Selection chain. Click a neuron or a connection to highlight it. Shift+click builds a chain across layers. Esc clears. Camera drags never change the selection.
- Layouts by layer type. Conv layers draw as feature-map slabs. Dense layers draw as neuron walls.
- Collapse and expand. Double-click a layer to fold it into one marker.
- Themes. Dark and light, one click away.
- Server fixes. One thread per request: a slow parse no longer blocks other drops.
nnviz servealso serves your generated HTML files.--portworks. Ctrl+C stops clean.
Install
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install onnx # only if you use ONNX files
pip install -e .
nnviz model.pth # writes model.html. Open it in a browser.
nnviz serve # drag & drop server at localhost:8000Known limits
- Beam fans cap at 3000 per connection. Big walls show a sample. Level of detail arrives in v0.8.
- Transposed MatMul weights may swap in and out feature counts.
- safetensors files are detected but not parsed yet (v0.5).
v0.2.0 — Import anything
One-click import gets real.
New
- Format auto-detection from file content: PyTorch, ONNX, safetensors (recognized)
- ONNX parser with true DAG edges (tensor provenance) — branched nets come out correct
- Model family classifier: MLP / CNN / Transformer
nnviz serve: drag & drop any model file on the page, the graph rebuilds live- Clear error reports in the CLI, the server, and the viewer
Install
pip install torch --index-url https://download.pytorch.org/whl/cpu onnx
pip install git+https://github.com/CLVwp/Neural_Network_Visualizer.git
nnviz serve # then drop a .pth or .onnx on the pageKnown limits
- Transposed MatMul weights may swap in/out feature counts.
- safetensors files are detected but not parsed yet (v0.5).
v0.1.0 — First light
First working release.
What works
- Import a PyTorch model: pickled
nn.Moduleorstate_dict(MLP and CNN) - Format and layer auto-detection from the file
- Interactive 3D graph in the browser: orbit, zoom, click a layer to inspect it
- One self-contained HTML output file. No server needed to view it.
- CLI:
nnviz model.pth -o model.html
Install
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install git+https://github.com/CLVwp/Neural_Network_Visualizer.git
nnviz model.pthKnown limits
- Connections follow layer definition order. Branched nets (ResNet) render as a chain until v0.4.
- Activations (ReLU, pooling) do not appear for
state_dictfiles: they carry no parameters.