This repo contains the PyTorch implementation of the DECOLLE learning rule presented in this paper.
If you use this code in a scientific publication, please include the following reference in your bibliography:
@article{kaiser2018synaptic,
title={Synaptic Plasticity Dynamics for Deep Continuous Local Learning (DECOLLE)},
author={Kaiser, Jacques and Mostafa, Hesham and Neftci, Emre},
journal={arXiv preprint arXiv:1811.10766},
year={2018}
}
This repo is a python package depending on PyTorch.
You can install it in a virtual environment (or locally with --user
) with the following command:
pip install -e .
pip install -r requirements.txt
By using the -e
option of pip, the files will be symlink'ed to your virtualenv instead of copied.
This means that you can modify the files of this repo without having to install it again for the changes to take effect.
You can reproduce the results presented in the original paper by running the following scripts:
samples/pytorch_conv3L_mnist.py
(orsamples/run_mnist_experiments.sh
)samples/pytorch_conv3L_dvsgestures_args.py
The latest requires you to download the DVS gesture dataset and move the DvsGesture
folder into the data
folder:
cd data
ln -s path_to_dvs_gestures/DVS\ \ Gesture\ dataset/DvsGesture/ .
You can browse our results without having to run the code. Check out the jupyter notebooks for the DvsGesture dataset and the MNIST dataset.
The core of the DECOLLE framework are implemented as torch Modules in dcll/pytorch_libdcll.py
.
Since we provide this code as a library, you can reuse the DECOLLE layers in your own PyTorch code:
import torch
from dcll.pytorch_libdcll import Conv2dDCLLlayer
layer = Conv2dDCLLlayer(...)
Have a look in samples/pytorch_conv3L_mnist.py for example usage.
The notebooks under tutorials are standalone, step-by-step instructions for setting up spiking neural networks in PyTorch and setting up DECOLLE. See for example tutorials/dcll_tutorial1.ipynb. NOTE: tutorials have been moved to https://github.com/surrogate-gradient-learning/pytorch-lif-autograd