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 onSNNRunConfig 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).
Contents
Section titled “Contents”| Name | |
|---|---|
SNNRunConfig | A run of SpikingClassifierObjective on SHD, with the encoder and the field it reads. |
SNNRunConfig
Section titled “SNNRunConfig”class SNNRunConfig(RunConfig)A run of SpikingClassifierObjective on SHD, with the encoder and the field it reads.
| Field | Type | Default |
|---|---|---|
objective | ObjectiveConfig | |
model | ModelConfig | |
data | SHD | dataclasses.field(default_factory=SHD) |
optim | OptimConfig | |
encoder | EncoderSpec | dataclasses.field(default_factory=EventsEncoder) |
sample | str | 'spikes' |
smoke | bool | False |
SNNRunConfig.smoked
Section titled “SNNRunConfig.smoked”def smoked() -> SNNRunConfigThis 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.
SNNRunConfig.sample_field
Section titled “SNNRunConfig.sample_field”def sample_field() -> FieldThe batch field the encoder reads, at the per-record shape the dataset writes.
SNNRunConfig.prepare
Section titled “SNNRunConfig.prepare”def prepare() -> PreparedThe 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.