sachinhosmani/torchvista
Interactive Pytorch forward pass visualization in notebooks
What it solves
It provides a way to visualize the forward pass of PyTorch models directly within web-based notebooks (like Jupyter, Colab, and Kaggle) using a single line of code, making it easier to understand and debug model architectures.
How it works
By using the trace_model function, the tool traces the execution of a model given specific inputs and generates an interactive graph. This graph allows users to interactively explore the model's structure, including nested modules and parameter information.
Who it’s for
PyTorch developers and researchers who need to visualize their model's data flow and architecture during development and debugging.
Highlights
- Interactive Visualization: Supports drag-and-zoom and collapsible nodes for hierarchical modules.
- Error-Tolerant: Provides partial visualization even when errors like shape mismatches occur, aiding in debugging.
- Detailed Node Info: Clicking on nodes reveals parameter and attribute information.
- Export Options: Graphs can be exported as PNG, SVG, or HTML files.
- Compressed View: An experimental feature that groups repeating nodes of the same type within
SequentialorModuleListinto single blocks.