Skip to content
GitHub

sparx.config

The run a spiking classifier trains as, one typed record that run.json holds.

python recipes/snn/train.py --data.channels 140 --trainer.batch-size 64 --trainer.steps 3000 \
--model.hidden 128 --model.classes 20 --model.delays 15 \
--objective.schedules '{"sigma": {"class": "linear", "fields": {"peak": 7.5, "end": 0.5}}}'
dew train runs/<name>/run.json --trust sparx --set trainer.steps=6000 # the same run, trained on

SNNRunConfig is dew’s RunConfig with the data, encoder and sample field a spiking classifier reads. Its model is any spiking model over [T, B, channels] by import path (--model my_package.models:Net), each of its fields a flag and the neuron template a record (--model.neuron '{"class": "sparx.nn.neurons:LIF", "fields": {"tau": 3.0}}'). The objective is SpikingClassifierObjective, each of its keyword arguments a flag (--objective.readout max), and prepare builds it around the model, the sample field and the encoder. Parameter groups with optimizers of their own are dew’s (--optim.param-groups).

Name
SNNRunConfigA run of SpikingClassifierObjective on SHD, with the encoder and the field it reads.
class SNNRunConfig(RunConfig)

sparx.config on GitHub

A run of SpikingClassifierObjective on SHD, with the encoder and the field it reads.

FieldTypeDefault
objectiveObjectiveConfig
modelModelConfig
dataSHDdataclasses.field(default_factory=SHD)
optimOptimConfig
encoderEncoderSpecdataclasses.field(default_factory=EventsEncoder)
samplestr'spikes'
smokeboolFalse
def smoked() -> SNNRunConfig

This run shrunk to a few seconds on CPU, reading synthetic recordings.

The recordings go under the checkpoint directory, so the run reads them there and leaves nothing elsewhere. The run it returns is no longer a smoke run: it records the small run as it trains, so its run.json trains that run again.

def sample_field() -> Field

The batch field the encoder reads, at the per-record shape the dataset writes.

def prepare() -> Prepared

The objective the run names, around its model, the sample field and the encoder, on SHD.

Its schedules run over the run’s steps unless the run states schedule_steps.