MCPcopy Index your code
hub / github.com/Da1sypetals/SnapViewer

github.com/Da1sypetals/SnapViewer @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
118 symbols 264 edges 17 files 42 documented · 36% updated 4mo agov0.0.0-alpha0 · 2025-06-12★ 752 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Snapviewer

A PyTorch memory snapshot viewer alternative to https://docs.pytorch.org/memory_viz with rich features. Display large snapshots smoothly!

Tested on Windows and macOS.

alt text

Usage:

  • You need Rust toolchain and Python installed.
  • First you need a virtual environment (via venv or conda). Here we use conda:
  • Activate your environment bash conda activate base
  • Install dependencies bash pip install -r requirements.txt
  • Compile binary bash cargo build --release --bin snapviewer-renderer --no-default-features

  • Run

-rr is for --resolution-ratio, used to deal with the rendering pattern of Apple's retina display. You probably need -rr 2.0 if you are using MacBook.

Option A: Pass the .pickle directly. Preprocessing artifacts are cached at ~/.snapviewer_cache/ and reused on subsequent runs. bash python gui.py --pickle snap/large.pickle --res 1200 500 -rr 2.0

Option B: Pre-process manually and pass the directory. ```bash # 1. Convert snapshot — outputs allocations.json and elements.db under the directory python convert_snap.py -i snap/large.pickle -o ./large

# 2. Run python gui.py --dir ./large --res 1200 500 -rr 2.0 ```

Warning: This software is in pre-alpha stage. Everything including snapshot format, data storing/loading logic is under frequent change.

Controls

  • Pan: WASD / Left Mouse Drag
  • Zoom: Mouse Wheel
  • (Ctrl + Left click) on an allocation for detailed info about it

Troubleshoot

  • If you see errors with message like cannot open input file 'sqlite3.lib', enable feature flag --features bundled-sqlite.

Notes

  • Minimal dependency is not a goal.
  • On macos, TKinter is required to run on main thread; while on all platforms the renderer is also required to run on main thread. This means we need multiple processes if we want to do cross platform.
  • todo:
  • test this zmq-based impl on linux

Core symbols most depended-on inside this repo

close
called by 6
gui.py
scale
called by 6
src/window_transform.rs
get_spinner
called by 5
src/utils.rs
translate_step
called by 4
src/window_transform.rs
enforce_boundaries
called by 4
src/window_transform.rs
translate
called by 4
src/window_transform.rs
connect
called by 3
gui.py
advance
called by 3
convert_snap.py

Shape

Method 61
Function 37
Class 19
Enum 1

Languages

Rust54%
Python46%

Modules by API surface

gui.py38 symbols
src/window_transform.rs16 symbols
src/render_loop.rs11 symbols
convert_snap.py10 symbols
src/ticks.rs8 symbols
src/geometry.rs7 symbols
src/allocation.rs6 symbols
src/main.rs5 symbols
notes/ticks.py5 symbols
src/utils.rs4 symbols
src/database/sqlite.rs4 symbols
src/render_data.rs2 symbols

For agents

$ claude mcp add SnapViewer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact