Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

The examples/ directory holds runnable programs. Each one exercises a kit or a system end to end, and its README says which bunsen features it uses and how to run it. They are not published, and they are where a change to a public API is felt first, so CI builds all of them.

Speech to text is bunsen-asr, a published binary rather than an example: files or the microphone, through the Parakeet, Qwen3-ASR and Whisper stream drivers, with commands that fetch and inspect models and manage the weights cache. It is built on the same bunsen-app plumbing.

ExampleWhat it shows
train-chatTrains a NanoChat GPT from scratch on streamed dataset shards, with nanochat’s Muon + AdamW parameter groups.
resnet_finetuneFine-tunes a pretrained ResNet for multi-label classification, with model surgery: a new head, a swapped activation, DropBlock and stochastic depth.
resnet_tinyTrains a ResNet from scratch on CINIC-10 through a firehose pipeline, loading a checkpoint into a modified prefab.
swin_tinyTrains a Swin Transformer V2 on CINIC-10, sharing resnet_tiny’s data pipeline.
conwayConway’s Game of Life in 2D and 3D, on any backend: an interactive view and a benchmark.
lbm2d_visA D2Q9 lattice-Boltzmann fluid simulation, rendered live.

Choosing a device

Every example picks its device at run time with --device (auto, cuda, metal, vulkan, wgpu or flex) and --device-index, through bunsen-app’s DeviceArgs. A backend is offered only when the example was built with its cargo feature (cuda, metal, vulkan, wgpu); flex, the CPU, always is, and auto, the default, takes the first accelerator built in. Each README has the exact command.

--precision picks the default float dtype: auto is the example’s own choice, full is f32, and half is the example’s half precision, which resolves per backend: bf16 where a training example wants f32’s range and the backend runs it well, f16 where any 16-bit float will do, and f32 on the CPU or where the backend lacks the half. --float-dtype and --int-dtype name an exact dtype instead. The training examples also draw burn’s terminal dashboard (their default tui feature) when run in a terminal. Features, backends and the network explains bunsen’s own backend features and why some examples also need fetch.