Retrieved article excerpt
Open article · Retrieved 2026-11-19T14:22:38.280907+00:00
[Svetoviz](https://github.com/PiotrGryko/svetoviz/blob/main/assets/images/logo_text.png)
### High-dimensional data visualization for NumPy, PyTorch, Hugging Face datasets and entire neural networks.
**Svetoviz is a debug viewer for tensors, images, NumPy arrays, datasets and PyTorch models.** It ships as a
single Python package (`svetoviz`) that streams your scene to a custom **WebGPU renderer** running in the browser,
and includes a **PyTorch debugger** that traces the *input -> weights -> output* relation of every basic `torch.nn`
module.
[Website](https://www.svetoviz.com)
[Documentation](https://www.svetoviz.com/docs)
[PyTorch Debugger](https://pytorch.svetoviz.com)
[Install](https://github.com/PiotrGryko/svetoviz#2-installation-and-quick-start)
[Python](https://github.com/PiotrGryko/svetoviz#2-installation-and-quick-start)
[Platforms](https://github.com/PiotrGryko/svetoviz#2-installation-and-quick-start)
[Renderer](https://github.com/PiotrGryko/svetoviz#1-overview)
[Modules](https://github.com/PiotrGryko/svetoviz#11-pytorch-modules-and-debugger)
**[Website](https://www.svetoviz.com)** | **[Documentation](https://www.svetoviz.com/docs)** | **[Install](https://github.com/PiotrGryko/svetoviz#2-installation-and-quick-start)**
---
## Table of Contents
- [1. Overview](https://github.com/PiotrGryko/svetoviz#1-overview)
- [What you can build](https://github.com/PiotrGryko/svetoviz#what-you-can-build)
- [Compatibility](https://github.com/PiotrGryko/svetoviz#compatibility)
- [Architecture](https://github.com/PiotrGryko/svetoviz#architecture)
- [Repository layout](https://github.com/PiotrGryko/svetoviz#repository-layout)
- [2. Installation and Quick Start](https://github.com/PiotrGryko/svetoviz#2-installation-and-quick-start)
- [Installation](https://github.com/PiotrGryko/svetoviz#installation)
- [Cache setup](https://github.com/PiotrGryko/svetoviz#cache-setup)
- [Demos](https://github.com/PiotrGryko/svetoviz#demos)
- [3. API Reference](https://github.com/PiotrGryko/svetoviz#3-api-reference)
- [Methods](https://github.com/PiotrGryko/svetoviz#methods)
- [WebConfig](https://github.com/PiotrGryko/svetoviz#webconfig)
- [Views classes](https://github.com/PiotrGryko/svetoviz#views-classes)
- [Layouts classes](https://github.com/PiotrGryko/svetoviz#layouts-classes)
- [Remote views](https://github.com/PiotrGryko/svetoviz#remote-views)
- [Utilities](https://github.com/PiotrGryko/svetoviz#utilities)
- [Terminal buffer helpers](https://github.com/PiotrGryko/svetoviz#terminal-buffer-helpers)
- [Supported dtypes](https://github.com/PiotrGryko/svetoviz#supported-dtypes)
- [4. Images](https://github.com/PiotrGryko/svetoviz#4-images)
- [Single image rendering](https://github.com/PiotrGryko/svetoviz#single-image-rendering)
- [Batch image inspection](https://github.com/PiotrGryko/svetoviz#batch-image-inspection)
- [Cache and performance](https://github.com/PiotrGryko/svetoviz#cache-and-performance)
- [5. NumPy](https://github.com/PiotrGryko/svetoviz#5-numpy)
- [Single array inspection](https://github.com/PiotrGryko/svetoviz#single-array-inspection)
- [Dimensional stacking and colormaps](https://github.com/PiotrGryko/svetoviz#dimensional-stacking-and-colormaps)
- [Visualizing multiple data types](https://github.com/PiotrGryko/svetoviz#visualizing-multiple-data-types)
- [Axis ordering and spatial mapping](https://github.com/PiotrGryko/svetoviz#axis-ordering-and-spatial-mapping)
- [High-dimensional large arrays](https://github.com/PiotrGryko/svetoviz#high-dimensional-large-arrays)
- [6. Datasets](https://github.com/PiotrGryko/svetoviz#6-datasets)
- [Building a dataset scene](https://github.com/PiotrGryko/svetoviz#building-a-dataset-scene)
- [Starting the dataset](https://github.com/PiotrGryko/svetoviz#starting-the-dataset)
- [Building the search database](https://github.com/PiotrGryko/svetoviz#building-the-search-database)
- [Compression and performance](https://github.com/PiotrGryko/svetoviz#compression-and-performance)
- [7. Views and Layouts](https://github.com/PiotrGryko/svetoviz#7-views-and-layouts)
- [Views and layouts](https://github.com/PiotrGryko/svetoviz#views-and-layouts)
- [NumpyView](https://github.com/PiotrGryko/svetoviz#numpyview)
- [ImageView](https://github.com/PiotrGryko/svetoviz#imageview)
- [DirectoryGridView](https://github.com/PiotrGryko/svetoviz#directorygridview)
- [DirectorySpiralView](https://github.com/PiotrGryko/svetoviz#directoryspiralview)
- [DatasetView](https://github.com/PiotrGryko/svetoviz#datasetview)
- [VerticalLayout](https://github.com/PiotrGryko/svetoviz#verticallayout)
- [HorizontalLayout](https://github.com/PiotrGryko/svetoviz#horizontallayout)
- [GridLayout](https://github.com/PiotrGryko/svetoviz#gridlayout)
- [Nesting layouts](https://github.com/PiotrGryko/svetoviz#nesting-layouts)
- [Offline scene building](https://github.com/PiotrGryko/svetoviz#offline-scene-building)
- [8. torch.Tensor](https://github.com/PiotrGryko/svetoviz#8-torchtensor)
- [Single torch.Tensor inspection](https://github.com/PiotrGryko/svetoviz#single-torchtensor-inspection)
- [Visualizing multiple tensor dtypes](https://github.com/PiotrGryko/svetoviz#visualizing-multiple-tensor-dtypes)
- [Axis ordering for tensors](https://github.com/PiotrGryko/svetoviz#axis-ordering-for-tensors)
- [9. Models](https://github.com/PiotrGryko/svetoviz#9-models)
- [GPT-2 terminal callback](https://github.com/PiotrGryko/svetoviz#gpt-2-terminal-callback)
- [DETR terminal callback](https://github.com/PiotrGryko/svetoviz#detr-terminal-callback)
- [Non-blocking mode](https://github.com/PiotrGryko/svetoviz#non-blocking-mode)
- [Diffusion pipeline](https://github.com/PiotrGryko/svetoviz#diffusion-pipeline)
- [Static model views](https://github.com/PiotrGryko/svetoviz#static-model-views)
- [Renderer settings](https://github.com/PiotrGryko/svetoviz#renderer-settings)
- [10. Python App](https://github.com/PiotrGryko/svetoviz#10-python-app)
- [One API surface](https://github.com/PiotrGryko/svetoviz#one-api-surface)
- [Explicit layout control](https://github.com/PiotrGryko/svetoviz#explicit-layout-control)
- [Image layouts](https://github.com/PiotrGryko/svetoviz#image-layouts)
- [Saving and loading](https://github.com/PiotrGryko/svetoviz#saving-and-loading)
- [11. PyTorch Modules and Debugger](https://github.com/PiotrGryko/svetoviz#11-pytorch-modules-and-debugger)
- [Interactive modules](https://github.com/PiotrGryko/svetoviz#interactive-modules)
- [Layer relations](https://github.com/PiotrGryko/svetoviz#layer-relations)
- [Module catalog](https://github.com/PiotrGryko/svetoviz#module-catalog)
- [12. Try Svetoviz Now](https://github.com/PiotrGryko/svetoviz#12-try-svetoviz-now)
- [13. Documentation Index](https://github.com/PiotrGryko/svetoviz#13-documentation-index)
- [Video demos](https://github.com/PiotrGryko/svetoviz#video-demos)
- [14. Links](https://github.com/PiotrGryko/svetoviz#14-links)
- [15. About](https://github.com/PiotrGryko/svetoviz#15-about)
> Every section below mirrors the matching page of the documentation site (<https://www.svetoviz.com/docs>) one to one, in the same order. The section-to-page mapping, including the reference script, is listed in [Documentation Index](https://github.com/PiotrGryko/svetoviz#13-documentation-index).
---
## 1. Overview
Svetoviz is a high-dimensional data visualization engine. It ships with a custom WebGPU renderer that renders entire models and datasets in the browser, and a Python package (`svetoviz`) that lets you build your own visualizations with your own data.
Your Python process builds a scene out of **Views** (data sources) and **Layouts** (spatial containers) and hands it to a renderer. Values are never flattened into a print statement or a single 2D image: every element gets a position in 3D space, and you navigate that space.
### What you can build
- **Model visualization:** render entire models and datasets in the browser via the custom WebGPU renderer, or open the scene directly from the public spaces directory.
- **Dataset browser:** visualize large datasets in the browser, or open the scene directly from the public spaces directory.
- **PyTorch Debugger:** track the input -> weights -> output relations for every basic PyTorch module.
- **Your own data:** build views from your own models, datasets and NumPy arrays with the Python package and open them in the browser - the renderer runs locally, no account needed.
### Compatibility
| Package | Renders in | macOS (Apple Silicon) | Linux | Python |
| --- | --- | --- | --- | --- |
| `svetoviz` | A modern browser (Chrome / Chromium WebGPU) | Yes | Yes (`x86_64` / `aarch64`) | **3.9 - 3.14** |
The single `svetoviz` package exposes one surface - `sv.array`, `sv.tensor`, `sv.image`, `sv.view`, `sv.pytorch`, `sv.model`, `sv.pipeline`, `sv.save_to_disk`, `sv.load_from_disk` - backed by one mapping implementation. It streams the scene to a browser tab and renders it client-side with a custom WebGPU pipeline: the renderer runs locally, so no account and no server-side compute are required.
### Architecture
```
your python process renderer user
--------------------- -------- ----
numpy / torch / PIL / HF dataset
|
+-- Views (NumpyView, TensorView, DatasetView, ModelView, ...)
|
+-- Layouts (Vertical / Horizontal / Grid / Directory / Spiral)
|
+-- sv.view(scene) -------------> WebGPU (browser) ---------> 3D scene
sv.save_to_disk(scene) --> tiles + tree.db --> sv.build_pmtiles_file() --> remote URL
```
This README mirrors the documentation site section by section. Every code block below is taken from the corresponding documentation page or from the reference script in this repository.
### Repository layout
```
.
|-- README.md # this document (GitHub landing page)
|-- app.py # local preview renderer for README.md (not part of the package)
|-- examples/
| `-- quickstart_webgpu.py # reference script for svetoviz
`-- assets/
`-- images/ # every screenshot embedded in this README
```
---
## 2. Installation and Quick Start
Svetoviz is currently distributed via pip.
### Installation
Install the Svetoviz package (WebGPU renderer) with the following command:
```
pip install svetoviz
```
Or using a private repository:
```
pip install svetoviz --extra-index-url https://svetoviz.com/webgpu/simple/
```
**Compatibility:** this package supports **macOS (Apple Silicon), Linux** and Python versions **3.9 through 3.14**.
Dependencies installed with the Svetoviz package:
```
dependencies = [
"Flask>=3.1,<4",
"flask-cors>=6.0,<7",
"waitress>=3.0,<4",
"websockets>=15,<16",
"opencv-python>=4.10",
"psd-tools==1.11.0",
"pmtiles==3.7.0",
"petname==2.9",
"requests>=2.32,<3",
"transformers>=4.57,<6",
"torch>=2.8",
"datasets>=4.5,<6",
]
```
**Quick start:** download [`examples/quickstart_webgpu.py`](https://github.com/PiotrGryko/svetoviz/blob/main/examples/quickstart_webgpu.py) for the full reference script. The minimal starting point from that file:
```
# examples/quickstart_webgpu.py
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
cache_dir = os.path.join(current_dir, "cache_test")
os.environ["SVETO_VIZ_CACHE_DIR"] = cache_dir
import svetoviz as sv
import numpy as np
print(f"Cache dir: {sv.get_cache_dir()}")
data = np.random.rand(4, 4, 32, 32).astype(np.float32)
sv.array(data, gap_size=10) # opens http://localhost:8000
```
### Cache setup
Cache data is written to `SVETO_VIZ_CACHE_DIR`. Set the variable **before** importing svetoviz, otherwise cache data gets stored inside site packages:
```
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
cache_dir = os.path.join(current_dir, "cache_