Package: norse
Adeep learninglibrary forspiking neural networks.Norse aims to exploit the advantages of bio-inspired neural components, which are sparse and event-driven - a fundamental difference from artificial neural networks.
Norse expandsPyTorchwith primitives for bio-inspired neural components,
bringing you two advantages: a modern and proven infrastructure based on PyTorch and deep learning-compatible spiking neural network components.Documentation:norse.github.io/norse/1. Getting startedThe fastest way to try Norse is via thejupyter notebooks on Google collab.Alternatively,you can install Norse locallyand run one of theincluded taskssuch asMNIST:python-mnorse.task.mnist2. Using NorseNorse presents plug-and-play components for deep learning with spiking neural networks.
Here, we describe how to install Norse and start to apply it in your own work.Read more in our documentation.2.1. InstallationWe assume you are usingPython version 3.7+and haveinstalled PyTorch version 1.9 or higher.Read more about the prerequisites in our documentation.MethodInstructionsPrerequisitesFrom PyPipip install norsePipFrom sourcepip install -qU git+https://github.com/norse/norsePip,PyTorchWith Dockerdocker pull quay.io/norse/norseDockerFrom Condaconda install -c norse norseAnacondaorMinicondaFor troubleshooting, please refer to ourinstallation guide,create an issue on GitHuborwrite us on Discord.2.2. Running examplesNorse is bundled with a number of example tasks, serving as short, self contained, correct examples (SSCCE).
They can be run by invoking thenorsemodule from the base directory.
More information and tasks are availablein our documentationand in your console by typing:python -m norse.task.<task> --help, where<task>is one of the task names.To train an MNIST classification network, invokepython-mnorse.task.mnistTo train a CIFAR classification network, invokepython-mnorse.task.cifar10To train the cartpole balancing task with Policy gradient, invokepython-mnorse.task.cartpoleNorse is compatible withPyTorch Lightning,
as demonstrated in thePyTorch Lightning MNIST task variant(requires PyTorch lightning):python-mnorse.task.mnist_pl--gpus=42.3. Example: Spiking convolutional classifierThis classifier is a taken from ourtutorial on training a spiking MNIST classifierand achieves >99% accuracy.importtorch,torch.nnasnnfromnorse.torchimportLICell# Leaky integratorfromnorse.torchimportLIFCell# Leaky integrate-and-firefromnorse.torchimportSequentialState# Stateful sequential layersmodel=SequentialState(nn.Conv2d(1,20,5,1),# Convolve from 1 -> 20 channelsLIFCell(),# Spiking activation layernn.MaxPool2d(2,2),nn.Conv2d(20,50,5,1),# Convolve from 20 -> 50 channelsLIFCell(),nn.MaxPool2d(2,2),nn.Flatten(),# Flatten to 800 unitsnn.Linear(800,10),LICell(),# Non-spiking integrator layer)data=torch.randn(8,1,28,28)# 8 batches, 1 channel, 28x28 pixelsoutput,state=model(data)# Provides a tuple (tensor (8, 10), neuron state)2.4. Example: Long short-term spiking neural networksThe long short-term spiking neural networks from the paper byG. Bellec, D. Salaj, A. Subramoney, R. Legenstein, and W. Maass (2018)is another interesting way to apply norse:importtorchfromnorse.torchimportLSNNRecurrent# Recurrent LSNN network with 2 input neurons and 10 output neuronslayer=LSNNRecurrent(2,10)# Generate data: 20 timesteps with 8 datapoints per batch for 2 neuronsdata=torch.zeros(20,8,2)# Tuple of (output spikes of shape (20, 8, 2), layer state)output,new_state=layer(data)3. Why Norse?Norse was created for two reasons: to 1) apply findings from decades of research in practical settings
and to 2) accelerate our own research within bio-inspired learning.We are passionate about Norse: we strive to follow best practices and promise to maintain this library for the
simple reason that we depend on it ourselves.
We have implemented a number of neuron models, synapse dynamics, encoding and decoding algorithms,
dataset integrations, tasks, and examples.
Combined with the PyTorch infrastructure and our high coding standards, we have found Norse to be an excellent tool for modellingscaleableexperiments andNorse is actively being used in research.Finally, we are working to keep Norse as performant as possible.
Preliminary benchmarks suggest that Norseachieves excellent performance on small networks of up to ~5000 neurons per layer.
Aided by the preexisting investment in scalable training and inference with PyTorch, Norse scales from a single laptop to several nodes on an HPC cluster with little effort.
As illustrated by ourPyTorch Lightning example task.Read more about Norse in our documentation.4. Similar workThe list of projects below serves to illustrate the state of the art, while explaining our own incentives to create and use norse.BindsNETalso builds on PyTorch and is explicitly targeted at machine learning tasks. It implements a Network abstraction with the typical 'node' and 'connection' notions common in spiking neural network simulators like nest.cuSNNis a C++ GPU-accelerated simulator for large-scale networks. The library focuses on CUDA and includes spike-time dependent plasicity (STDP) learning rules.decolleimplements an online learning algorithm described in the paper"Synaptic Plasticity Dynamics for Deep Continuous Local Learning (DECOLLE)"by J. Kaiser, M. Mostafa and E. Neftci.GeNNcompiles SNN network models to NVIDIA CUDA to achieve high-performing SNN model simulations.Long short-term memory Spiking Neural Networks (LSNN)is a tool from the University of Graaz for modelling LSNN cells inTensorflow. The library focuses on a single neuron and gradient model.Nengois a neuron simulator, and Nengo-DL is a deep learning network simulator that optimised spike-based neural networks based on an approximation method suggested byHunsberger and Eliasmith (2016).Nengo PyTorcha thin wrapper for PyTorch that adds a single voltage-only spiking model. The approach is independent from the Nengo framework.Neuron Simulation Toolkit (NEST)constructs and evaluates highly detailed simulations of spiking neural networks. This is useful in a medical/biological sense but maps poorly to large datasets and deep learning.PyNNis a Python interface that allows you to define and simulate spiking neural network models on different backends (both software simulators and neuromorphic hardware). It does not currently provide mechanisms for optimisation or arbitrary synaptic plasticity.PySNNis a PyTorch extension similar to Norse. Its approach to model building is slightly different than Norse in that the neurons are stateful.Rockpoolis a Python package developed by SynSense for training, simulating and deploying spiking neural networks. It offers both JAX and PyTorch primitives.Sinabsis a PyTorch extension bySynSense. It mainly focuses on convolutions and translation to neuromorphic hardware.SlayerPyTorchis aSpikeLAYerErrorReassignment library, that focuses on solutions for the temporal credit problem of spiking neurons and a probabilistic approach to backpropagation errors. It includes support for theLoihi chip.SNN toolboxautomates the conversion of pre-trained analog to spiking neural networks. The tool is solely for already trained networks and omits the (possibly platform specific) training.snnTorchis a simulator built on PyTorch, featuring severalintroduction tutorialson deep learning with SNNs.SpikingJellyis another PyTorch-based spiking neural network simulator. SpikingJelly uses stateful neurons.Example of training a network on MNIST.SpyTorchpresents a set of tutorials for training SNNs with the surrogate gradient approach SuperSpike byF. Zenke, and S. Ganguli (2017). Norseimplements the SuperSpike surrogate gradient function, but allows for other surrogate gradients and training approaches.s2netis based on the implementation presented inSpyTorch, but implements convolutional layers as well. It also contains a demonstration how to use those primitives to train a model on theGoogle Speech Commands dataset.5. ContributingContributions are warmly encouraged and always welcome. However, we also have high expectations around the code base so if you wish to contribute, please refer to ourcontribution guidelines.6. CreditsNorse is created byChristian Pehle(@GitHubcpehle), PostDoc at University of Heidelberg, Germany.Jens E. Pedersen(@GitHubjegp), doctoral student at KTH Royal Institute of Technology, Sweden.More information about Norse can be foundin our documentation. The research has received funding from the EC Horizon 2020 Framework Programme under Grant Agreements 785907 and 945539 (HBP) and by the Deutsche Forschungsgemeinschaft (DFG, German Research Fundation) under Germany's Excellence Strategy EXC 2181/1 - 390900948 (the Heidelberg STRUCTURES Excellence Cluster).7. CitationIf you use Norse in your work, please cite it as follows:@software{norse2021,author={Pehle, Christian andPedersen, Jens Egholm},title={{Norse -  A deep learning library for spikingneural networks}},month=jan,year=2021,note={Documentation: https://norse.ai/docs/},publisher={Zenodo},version={0.0.7},doi={10.5281/zenodo.4422025},url={https://doi.org/10.5281/zenodo.4422025}}Norse is actively applied and cited in the literature. We are keeping track of the papers cited by Norsein our documentation.8. LicenseLGPLv3. SeeLICENSEfor license details.