Skip to content
sultanimanPublic

About

wetron is a browser-based neural network model visualizer. Open a model and explore its computation graph interactively.

Topics

Resources

Code of conduct

Contributing

Stars

41 stars

Watchers

0 watching

Forks

Repository files navigation

wetron

wetron.app - Browser-native inspector for neural network models and GGUF LLM files. Open a model file and explore its computation graph, metadata, tensor shapes, and weight statistics - fully in the browser, no upload, no server, no telemetry.

Wetron showing a SavedModel graph with the weight panel open on a conv kernel

Why

Existing model inspection tools either run as native desktop apps (Netron) or push files through hosted services. Neither is acceptable when the model itself is the sensitive artefact - proprietary weights, medical models, audited systems under the EU AI Act, or research code that can't leave a network.

Wetron is a model inspector that runs entirely client-side as an embeddable library. That makes it useful for:

  • AI auditability - regulators, journalists, and civic-tech reviewers can inspect third-party models without exposing them to a SaaS.
  • Privacy-sensitive ML - medical, defence, and on-device models can be inspected without leaving the host machine.
  • FOSS infrastructure - the @wetron/* packages are designed to be embedded by other open-source projects (model registries, dataset cards, scientific notebooks).

Parsing uses browser APIs such as ArrayBuffer, DataView, TextDecoder, and DecompressionStream, together with format libraries including protobufjs, flatbuffers, fflate, and h5wasm. Weight bytes are decoded lazily on demand for the property panel; they're never uploaded or persisted.

Packages

Package Description
@wetron/core IR types, format detection, dtype utilities, Dagre layout
@wetron/onnx ONNX parser (protobufjs)
@wetron/tflite TFLite parser (flatbuffers)
@wetron/keras Keras .keras archive parser
@wetron/gguf GGUF metadata, quantized tensor, and weight parser
@wetron/torchscript TorchScript Mobile and ZIP-based .pt parser
@wetron/executorch ExecuTorch .pte parser (flatbuffers)
@wetron/savedmodel TF SavedModel .pb parser + TF2 checkpoint loader
@wetron/react React graph view and property panel
@wetron/svelte Svelte graph view and property panel
@wetron/tokens Theme constants (colors, CSS vars) - no dependencies

@wetron/tokens is intentionally standalone: zero runtime or peer dependencies, usable without any other wetron package.

Keeping tokens in sync with core: OpCategory is defined in both @wetron/core and @wetron/tokens. If you add a new category, update both - then update CATEGORY_THEME in tokens/src/index.ts. pnpm exec vitest run packages/tokens enforces this at runtime.

Install

# parse + render with React
pnpm add @wetron/react

# parse only (no UI)
pnpm add @wetron/core

@wetron/react depends on @wetron/core, and @wetron/core depends on all parser packages.

Peer dependencies for @wetron/react: react >=18, @xyflow/react >=12, @phosphor-icons/react >=2, @base-ui/react >=1.

Usage

import { parseModel } from "@wetron/core";

const bytes = new Uint8Array(await file.arrayBuffer());
const graph = await parseModel(bytes, file.name); // auto-detects format from magic bytes
import { ModelGraphView } from "@wetron/react";
import "@wetron/react/styles.css";

<ModelGraphView graph={graph} colorMode="system" />;

See the docs for the full API reference, Svelte examples, and theming tokens.

Weight inspectors

Select an initializer tensor and the property panel decodes its bytes on demand, then offers the views that fit the tensor: matrix, distribution, per-axis profile, sparsity, kernel gallery, quantization (GGUF Q4_0), diagnostics, and raw values.

Matrix inspector - 2-D slice heatmap
matrix
Kernel gallery inspector - per-filter spatial kernels
kernel gallery
Diagnostics inspector - outlier and constant slice findings
diagnostics

Development

git clone https://github.com/sultaniman/wetron
cd wetron
pnpm install

Build

pnpm run build        # all packages (common/core libs -> parsers -> core index -> React/tokens + Svelte validation)

Test

pnpm exec vitest run                       # all packages
pnpm exec vitest run packages/core         # one package

Demo apps

cd apps/demo && pnpm dev          # React
cd apps/demo-svelte && pnpm dev   # Svelte

Docs

cd docs && pnpm run setup && pnpm run dev   # Hugo site at localhost:1313

The docs site is not a workspace package and needs a flat node_modules for Hugo's module mounts and Sass import paths, so install it with pnpm run setup (pnpm install --ignore-workspace) rather than a plain pnpm install.

Documentation

  • Guide - installation, quick start, architecture
  • API Reference - parseModel, detectFormat, IR types
  • Formats - ONNX, TFLite, Keras, GGUF, TorchScript, ExecuTorch
  • Rendering - React, Svelte, theming tokens
  • Contributing - adding a new parser
  • Changelog - release notes per version

Constraints

  • Browser-only. All I/O uses file.arrayBuffer(), fetch, TextDecoder, DataView.
  • Weight bytes are exposed via WeightSource and decoded lazily on demand - never uploaded, never persisted.
  • No patching of DataView.prototype or BigInt.prototype.
  • detectFormat always returns a Format string, never throws.

Related work

Netron by Lutz Roeder is used as a reference for schema field layouts and node-count parity across supported formats. The parsers and rendering layers in wetron are independent implementations.

About

wetron is a browser-based neural network model visualizer. Open a model and explore its computation graph interactively.

Topics

Resources

Code of conduct

Contributing

Stars

41 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages