A neural network visualization tool
Project description
nnViewer
nnViewer is a Python library designed to provide an intuitive GUI for visualizing the structure and flow of a torch.nn.Module. Whether you're debugging or exploring complex neural networks, nnViewer makes it easier to understand your models.
Installation
Install the library via pip:
pip install nnViewer
Quick Start
Here's an example of how to use nnViewer with a Hugging Face model:
from transformers import AutoImageProcessor, AutoModel
from PIL import Image
import requests
from nnViewer.back.graph_initializer import wrap_model
from nnViewer.front.gui import run_gui
# Load an image
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
# Load the model and processor
processor = AutoImageProcessor.from_pretrained('facebook/dinov2-large')
model = AutoModel.from_pretrained('facebook/dinov2-large')
# Prepare the inputs
inputs = processor(images=image, return_tensors="pt")
# Initialize the graph
graph_init = wrap_model(model)
# Run the model to populate the graph
model(**inputs)
# Launch the GUI
run_gui(graph_init.graph)
Overview
wrap_model(model: nn.Module) -> GraphInitializer
Wraps a torch.nn.Module to initialize the computational graph for visualization.
run_gui(graph)
Launches the GUI to display the computational graph.
Contributing
Contributions are welcome! If you find any issues or have feature requests, feel free to open a GitHub issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nnviewer-0.1.0.tar.gz.
File metadata
- Download URL: nnviewer-0.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e42f52c52978c2976aafb04b75d045c08c5e25c72a1968363ca07e11bdd94f3
|
|
| MD5 |
d7f40f7d69d39dd8eba552444e315b72
|
|
| BLAKE2b-256 |
edc83e49ccd812d8b10b3aa7939a7b6b6bed0421cda612bc5219f1966ee77f09
|
File details
Details for the file nnViewer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nnViewer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d89917f310a946e140b12f2b6de65a1d59b2848aac9a2f7dffcfe3441f39cfd
|
|
| MD5 |
b73e0da467c5732c2d441e168614c917
|
|
| BLAKE2b-256 |
e11017e3613a946fc29012ed7d9a48572177b1c320c70a6fa5560e20a66fd55f
|