ONNX Adapter for google-ai-edge/model-explorer
pip install --upgrade model-explorer-onnx
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.
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.
Get node color themes here
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





