Kits
A kit is a whole thing you can pick up and use: a model family with its configs, the weights it can load and a program that runs it, or a simulation you can step. Where blocks and ops are parts, a kit is what the parts are for.
The bunsen::kits docs list the kits, and describe
the anatomy of a kit piece by piece, with a
table of how the ResNet, Whisper and Silero kits fill each piece in. This
page explains why kits are shaped that way, and what building one involves.
Why a shared shape
No trait makes a module a kit. Kits share a shape because they solve the same problems, and a solved problem should look the same each time it appears:
- Naming a model. A user should be able to say
resnet50oropenai/base.enand get a model. A prefab map names geometries; a pretrained table names checkpoints; a factory turns either name into a loaded module. The machinery is shared and lives inbunsen::data::pretrained. A kit contributes tables and aConstructhook, not a loader of its own. See Files, caches and pretrained models. - Configuring it. A kit’s configs follow the Simple or Stacked shape from Module design conventions. A user-facing policy config is small and stable; the structure config spells out the implementation.
- Running it. A model that decodes or streams keeps no per-stream state of its own. The state is injected as a context or cache, so one loaded model serves several streams. See Stateless modules and streaming contexts.
- Trusting it. A port of a published model is only as good as its agreement with the original. Kits that load published weights have a validation crate that steps them against the reference implementation. See Validation against reference implementations.
Building a kit
A new kit grows in roughly this order, and each step is useful on its own:
- The model and its configs, in the kit’s module, built from existing
blocks and ops where they fit, with shape contracts at its boundaries and
a narrow
Metatrait. - An example under
examples/that runs it end to end. - Names: a prefab map, then pretrained rows and a
Constructhook, and adefault_{kit}_factory(), once there are weights to load. - A validation crate under
crates/validation/, once the kit claims parity with an upstream implementation. - Promotion: a layer that a second kit needs moves out to
blocksorops.
The kit’s module docs carry its lifecycle and an example; the
bunsen::kits table gains a row. This book doesn’t
need to change unless the kit brings a new cross-cutting system.
Kits evolve faster than the rest of the crate while their domains are being
filled in; see bunsen::kits on stability.