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.1.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.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nnviewer-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 49d967e6f38ecdc198c751f7ac13045f6bee396dc0a0d572147197ce9b613d04
MD5 b8f67cb41fafe522aa38f0a2139b7c1c
BLAKE2b-256 72e8946829a44eedc6ab9785e3961dbd05ee3209c2eb8892b4ab74bcf0055674

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nnViewer-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73c9453f4b89e78ca3b8c9906eacd9c4f8080b393af48fb1289c5d8190a31e8f
MD5 6a50b065fb1bef99a8db55fa0a00585d
BLAKE2b-256 eda11c72edf0338f9b5817798a10d753e56fa31896c51bc104012fc98891721b

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