Skip to main content

Adapter for ai-edge-model-explorer to support ONNX models

Project description

Model Explorer ONNX Adapter

PyPI - Version PyPI - Downloads Ruff

ONNX Adapter for google-ai-edge/model-explorer

Installation

pip install --upgrade model-explorer-onnx

Usage

model-explorer --extensions=model_explorer_onnx

# Or as a shortcut
onnxvis

# Supply model path
onnxvis model.onnx

[!NOTE] Model Explorer only supports WSL on Windows.

Read more on the Model Explorer User Guide.

Notes on representation

Graph input/output/initializers in ONNX are values (edges), not nodes. A node is displayed here for visualization. Graph inputs that are initialized by initializers are displayed as InitializedInput, and are displayed closer to nodes that use them.

Color Themes

Get node color themes here

Visualizing PyTorch ONNX exporter (dynamo=True) accuracy results

[!NOTE] verify_onnx_program requires PyTorch 2.7 or newer

import torch
from torch.onnx.verification import verify_onnx_program

from model_explorer_onnx.torch_utils import save_node_data_from_verification_info

# Export the and save model
onnx_program = torch.onnx.export(model, args, dynamo=True)
onnx_program.save("model.onnx")

verification_infos = verify_onnx_program(onnx_program, compare_intermediates=True)

# Produce node data for Model Explorer for visualization
save_node_data_from_verification_info(
    verification_infos, onnx_program.model, model_name="model"
)

You can then use Model Explorer to visualize the results by loading the generated node data files:

onnxvis model.onnx --node_data_paths=model_max_abs_diff.json,model_max_rel_diff.json

node_data

Screenshots

image image image image image image

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

model_explorer_onnx-0.3.7.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

model_explorer_onnx-0.3.7-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file model_explorer_onnx-0.3.7.tar.gz.

File metadata

  • Download URL: model_explorer_onnx-0.3.7.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for model_explorer_onnx-0.3.7.tar.gz
Algorithm Hash digest
SHA256 3ad6a770e8e1ec25b57b68ec415e8f46f4e0edd6da640e1d756ab0788b00004a
MD5 59db0644d0d25c137e69830e8d8961cc
BLAKE2b-256 b28464c72cc24e90f19c25b12eaf5d53151ab92744bdcda063940711ed6e58b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_explorer_onnx-0.3.7.tar.gz:

Publisher: main.yaml on justinchuby/model-explorer-onnx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file model_explorer_onnx-0.3.7-py3-none-any.whl.

File metadata

File hashes

Hashes for model_explorer_onnx-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5a1e8c059d1c7a92b493c200144f81ab4399dffa2d5c27d56c9a4a54b20a0aae
MD5 f428b70178ade98db133d07e92e7ab09
BLAKE2b-256 5efa6e0ffc5891515fcd6ff59e991472d317384211a83b443e554c8e966fba2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_explorer_onnx-0.3.7-py3-none-any.whl:

Publisher: main.yaml on justinchuby/model-explorer-onnx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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