Language: 中文 | English

欢迎来到惊蜇(SpikingJelly)的文档#

SpikingJelly 是一个基于 PyTorch ,使用脉冲神经网络(Spiking Neural Network, SNN)进行深度学习的框架。

版本说明#

自 0.0.0.0.14 版本开始,包括 clock_driven 和 event_driven 在内的模块被重命名了,请参考教程 从老版本迁移。

V2 版本更新记录见 变更日志 | Changelog。

不同版本文档的地址(其中 latest 是开发版):

安装#

在已激活的虚拟环境中使用 uv;V2 要求 Python >= 3.11、Torch >= 2.6。请先安装适合设备的 PyTorch。

安装方式

命令

PyPI 发布版

uv pip install spikingjelly

PyPI 先行版

uv pip install --pre spikingjelly

可选 Triton(缺少时)

uv pip install "spikingjelly[triton]"

最新源码开发版

uv pip install git+https://github.com/fangwei123456/spikingjelly.git

原生 CUDA(需要工具链,对应 V2 版本发布到 PyPI 后可用):

SJ_BUILD_NATIVE_CUDA=1 uv pip install \
  --no-build-isolation --no-binary spikingjelly \
  --reinstall-package spikingjelly --no-cache "spikingjelly>=2.0.0"

前置条件、决策图、其他可选依赖及排查方法见 安装指南。 尚未发布的改动请安装源码开发版。

上手教程#

引用和出版物#

如果您在自己的工作中用到了惊蜇(SpikingJelly),您可以按照下列格式进行引用:

@article{
doi:10.1126/sciadv.adi1480,
author = {Wei Fang  and Yanqi Chen  and Jianhao Ding  and Zhaofei Yu  and Timothée Masquelier  and Ding Chen  and Liwei Huang  and Huihui Zhou  and Guoqi Li  and Yonghong Tian },
title = {SpikingJelly: An open-source machine learning infrastructure platform for spike-based intelligence},
journal = {Science Advances},
volume = {9},
number = {40},
pages = {eadi1480},
year = {2023},
doi = {10.1126/sciadv.adi1480},
URL = {https://www.science.org/doi/abs/10.1126/sciadv.adi1480},
eprint = {https://www.science.org/doi/pdf/10.1126/sciadv.adi1480},
abstract = {Spiking neural networks (SNNs) aim to realize brain-inspired intelligence on neuromorphic chips with high energy efficiency by introducing neural dynamics and spike properties. As the emerging spiking deep learning paradigm attracts increasing interest, traditional programming frameworks cannot meet the demands of the automatic differentiation, parallel computation acceleration, and high integration of processing neuromorphic datasets and deployment. In this work, we present the SpikingJelly framework to address the aforementioned dilemma. We contribute a full-stack toolkit for preprocessing neuromorphic datasets, building deep SNNs, optimizing their parameters, and deploying SNNs on neuromorphic chips. Compared to existing methods, the training of deep SNNs can be accelerated 11×, and the superior extensibility and flexibility of SpikingJelly enable users to accelerate custom models at low costs through multilevel inheritance and semiautomatic code generation. SpikingJelly paves the way for synthesizing truly energy-efficient SNN-based machine intelligence systems, which will enrich the ecology of neuromorphic computing. Motivation and introduction of the software framework SpikingJelly for spiking deep learning.}}

使用惊蜇(SpikingJelly)的出版物可见于 出版物 | Publications 。

许可证#

SpikingJelly 的项目许可证为 Apache-2.0。 第三方归属与许可条款汇总于 LICENSES/NOTICE。 适用范围与历史许可证见 许可证指南。

项目信息#

北京大学信息科学技术学院数字媒体所媒体学习组 Multimedia Learning Group 和 鹏城实验室 是SpikingJelly的主要负责机构。

_images/pku.png _images/pcl.png

SpikingJelly主要由以下开发者开发维护:

2024.07~现在: 黄一凡, 薛鹏

2019.12~2024.06: 方维, 陈彦骐, 丁健豪, 陈鼎, 黄力炜

全体贡献者名单可见于 贡献者 。

友情链接#

Welcome to SpikingJelly's documentation#

SpikingJelly is a deep learning framework for Spiking Neural Network (SNN) based on PyTorch.

Notification#

From the version 0.0.0.0.14, modules including clock_driven and event_driven are renamed. Please refer to the tutorial Migrate from old versions.

See 变更日志 | Changelog for the V2 release changelog.

Docs for different versions (latest is the developing version):

Installation#

Use uv in an activated virtual environment. V2 requires Python >= 3.11 and Torch >= 2.6. First install the appropriate PyTorch for your device.

Install

Command

PyPI release

uv pip install spikingjelly

PyPI pre-release

uv pip install --pre spikingjelly

Optional Triton (if missing)

uv pip install "spikingjelly[triton]"

Latest development source

uv pip install git+https://github.com/fangwei123456/spikingjelly.git

Native CUDA (requires a toolchain; available after the corresponding V2 PyPI release):

SJ_BUILD_NATIVE_CUDA=1 uv pip install \
  --no-build-isolation --no-binary spikingjelly \
  --reinstall-package spikingjelly --no-cache "spikingjelly>=2.0.0"

See Installation Guide for prerequisites, decision diagrams, other extras and troubleshooting. Unreleased changes require the development source.

Tutorials#

Citation#

If you use SpikingJelly in your work, please cite it as follows:

@article{
doi:10.1126/sciadv.adi1480,
author = {Wei Fang  and Yanqi Chen  and Jianhao Ding  and Zhaofei Yu  and Timothée Masquelier  and Ding Chen  and Liwei Huang  and Huihui Zhou  and Guoqi Li  and Yonghong Tian },
title = {SpikingJelly: An open-source machine learning infrastructure platform for spike-based intelligence},
journal = {Science Advances},
volume = {9},
number = {40},
pages = {eadi1480},
year = {2023},
doi = {10.1126/sciadv.adi1480},
URL = {https://www.science.org/doi/abs/10.1126/sciadv.adi1480},
eprint = {https://www.science.org/doi/pdf/10.1126/sciadv.adi1480},
abstract = {Spiking neural networks (SNNs) aim to realize brain-inspired intelligence on neuromorphic chips with high energy efficiency by introducing neural dynamics and spike properties. As the emerging spiking deep learning paradigm attracts increasing interest, traditional programming frameworks cannot meet the demands of the automatic differentiation, parallel computation acceleration, and high integration of processing neuromorphic datasets and deployment. In this work, we present the SpikingJelly framework to address the aforementioned dilemma. We contribute a full-stack toolkit for preprocessing neuromorphic datasets, building deep SNNs, optimizing their parameters, and deploying SNNs on neuromorphic chips. Compared to existing methods, the training of deep SNNs can be accelerated 11×, and the superior extensibility and flexibility of SpikingJelly enable users to accelerate custom models at low costs through multilevel inheritance and semiautomatic code generation. SpikingJelly paves the way for synthesizing truly energy-efficient SNN-based machine intelligence systems, which will enrich the ecology of neuromorphic computing. Motivation and introduction of the software framework SpikingJelly for spiking deep learning.}}

Publications using SpikingJelly are recorded in 出版物 | Publications.

License#

SpikingJelly's project license is Apache-2.0. Third-party attributions and license terms are collected in LICENSES/NOTICE. Scope and historical licenses are described in the license guide.

About#

Multimedia Learning Group, Institute of Digital Media (NELVT), Peking University and Peng Cheng Laboratory are the main institutions behind the development of SpikingJelly.

_images/pku.png _images/pcl.png

SpikingJelly has been developed and maintained by multiple main developers over time.

2024.07~Now: Yifan Huang, Peng Xue

2019.12~2024.06: Wei Fang, Yanqi Chen, Jianhao Ding, Ding Chen, Liwei Huang

The list of contributors can be found at contributors.