Skip to main content

NeuralVeil CLI — part of the NeuralVeil Tensor Shape Debugger. Graph any PyTorch model architecture in one command using torch.fx and forward hooks. Captures real tensor shapes locally — no server, no code upload, works in air-gapped environments.

Project description

neuralveil

Graph your PyTorch model architecture in one command.

pip install neuralveil
neuralveil parse model.py

Drop the output into neuralveil.dev and see your model as an interactive graph — layers, tensor shapes, parameter counts — all verified by actually running your code.


How it works

your model.py  ──▶  neuralveil parse  ──▶  your local PyTorch
                                                    │
                                         torch.fx trace / forward hooks
                                                    │
                          neuralveil_output.json  ◀─┘
                                    │
                        drop into neuralveil.dev  ──▶  interactive graph

The CLI tries two capture strategies, in order:

1. torch.fx symbolic trace (preferred) PyTorch's official graph capture API. Traces forward() into a structured FX graph IR with typed nodes, operator types, and shapes. Handles VGG, ResNet, DenseNet, and most CNN families cleanly.

2. register_forward_hook (fallback) For models with dynamic control flow that torch.fx can't symbolically trace. Runs a dummy forward pass with hooks on every named submodule, capturing real input/output shapes and parameter counts. Works on virtually any valid PyTorch model.


Installation

pip install neuralveil

PyTorch is listed as an optional dependency — ML engineers already have it. If you're setting up a fresh environment:

pip install "neuralveil[torch]"

Requirements: Python ≥ 3.9


Usage

# basic
neuralveil parse model.py

# specify input shape
neuralveil parse model.py --input 1,3,224,224

# custom output path
neuralveil parse model.py --output my_graph.json

If the file defines multiple nn.Module subclasses, the CLI will prompt you to pick one.

Python API

import neuralveil

graph = neuralveil.parse_model("model.py", input_shape=(1, 3, 224, 224))
print(graph["nodes"])

Security model

The CLI runs entirely on your machine. There is no server, no code upload, no API key, no rate limit.

  • Your code never leaves your environment
  • Works fully offline and in air-gapped environments
  • Execution timeout: 15 seconds (SIGKILL after)

Contributing

Issues and PRs welcome. Built by Gyan Shresth · Apache 2.0

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

neuralveil-1.0.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

neuralveil-1.0.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file neuralveil-1.0.0.tar.gz.

File metadata

  • Download URL: neuralveil-1.0.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for neuralveil-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f3f5d2c45eb433852c7b5619788d8e8320d6c709f8e5308439cd7eba95ceba1
MD5 58cdb0c28af42a47f5358a317abb1365
BLAKE2b-256 ea55328d344e9fdc2953243e0679a0b9b32aa84ba889c814e53e9c145fd3cd37

See more details on using hashes here.

File details

Details for the file neuralveil-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: neuralveil-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for neuralveil-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55380090056e04a187c27e0354de53b74d4e51f92c944f9985fed7f6df193bc7
MD5 08674bb9f936aa6ceeb0018218ab2d70
BLAKE2b-256 d766539d7c6367c3f7ebaf58aa6b6a0f7eadc9ee4c4c1c6baf7fdec88647a2f5

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