Repository navigation
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.