Brew your PyTorch SNN models into ESP32-S3-ready C headers.
Features • Quick Start • CLI Usage • Generated Output • Examples • ESP32 Tests • Citation
- Seamless Transformation: Export trained PyTorch SNN attitude and control checkpoints into ESP32-S3-ready C/header files.
- ESP32-S3 Ready: Generate controller headers and runtime files for ESP32-S3 firmware projects.
- Different Runtime Backends: Choose between
optimizedandevent-drivenruntime modes. - Flexible Model Inputs: Use direct
.ptfiles, folders containingmodel.pt, or Weights & Biases run names. - Controller Header Generation: Generate the main controller configuration header and controller component headers.
- Batch Processing: Convert the attitude and control networks with a single command.
git clone <repo-url>
cd espikify
python -m pip install -e .Package requirements:
| Requirement | Version |
|---|---|
| Python | >=3.10 |
numpy |
>=1.24 |
torch |
>=2.0 |
wandb |
>=0.16 |
Check the CLI:
espikify --helpespikify \
--att-model ATT_MODEL \
--control-model CONTROL_MODEL \
--mode {optimized,event-driven} \
[--output-dir DIR] \
[--wandb-project PROJECT] \
[--models-dir DIR] \
[--att-mask CSV] \
[--control-mask CSV] \
[--no-copy-runtime]An export writes:
<output-dir>/
├── test_controller_fwr_conf.h
├── controller/
│ └── test_controller_*_file.h
└── runtime/ # omitted with --no-copy-runtime
espikify \
--att-model ./models/attitude/model.pt \
--control-model ./models/control \
--mode optimized \
--output-dir ./build/optimized_exportespikify \
--att-model ./models/attitude \
--control-model ./models/control \
--mode event-driven \
--output-dir ./build/event_exportThe repository includes two Arduino sketches for testing generated controller exports:
| Sketch | Use with |
|---|---|
optimized-snn.ino |
--mode optimized |
snn-event-driven.ino |
--mode event-driven |
Use the sketch that matches the selected export mode. Both sketches load test_controller_fwr_conf.h, build a NetworkController, run forward_network, and stream controller output over serial. The event-driven sketch also uses the event-driven runtime path and reports spike-count statistics.
Espikify stands on the shoulders of giants. We are grateful to these projects and communities:
- TinySNN — MIT Licensed. This work inspired the project.
- Espressif Systems — for the ESP32-S3 platform and ecosystem.
Contributions and issue reports are welcome.
Rim El Filali, Chenrui Feng, Chao Gao, and Weibin Gu (2026). Spiking Neural Network Control of a Flapping-Wing Robot on Resource-Constrained Hardware. Proceedings of The 10th Conference on Robot Learning, in Proceedings of Machine Learning Research.
