Skip to main content

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

nnviewer-0.1.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nnViewer-0.1.2-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file nnviewer-0.1.2.tar.gz.

File metadata

  • Download URL: nnviewer-0.1.2.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

Hashes for nnviewer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a6c63feaf1a97ee5585e1afb8013b9482bbba413346f9e124b6f696e114b04d1
MD5 44d330c9c8f9cbd16c4c68b602268ac0
BLAKE2b-256 8f4afeaab05c71db367d2d97cc4e623e8b1f0067c33d6a0564b21a400285fce2

See more details on using hashes here.

File details

Details for the file nnViewer-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nnViewer-0.1.2-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

Hashes for nnViewer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 101c0e63c44d61b88e83d0de81fd246628ad2f5f77dee91eef0e45acd1240f74
MD5 de178ce7149bd8f200e3fb006aa815d7
BLAKE2b-256 b92651b38fa63a198fdabb2126ef62aba033570de66cd4e5cb03b7b3acd076d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page