Skip to main content

A Spiking Neural Networks simulator built on PyTorch.

Project description

SpikingJelly

GitHub last commitDocumentation Status PyPI PyPI - Python Version License

English | 中文

demo

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.

The documentation of SpikingJelly is written in both English and Chinese: https://spikingjelly.readthedocs.io

Installation

Note that SpikingJelly is based on PyTorch. Please make sure that you have installed PyTorch before you install SpikingJelly.

Install from PyPI

pip install spikingjelly

Developers can download and install the latest version from GitHub:

git clone https://github.com/fangwei123456/spikingjelly.git
cd spikingjelly
python setup.py install

Build SNN In An Unprecedented Simple Way

SpikingJelly is user-friendly. Building SNN with SpikingJelly is as simple as building ANN in PyTorch:

class Net(nn.Module):
    def __init__(self, tau=100.0, v_threshold=1.0, v_reset=0.0):
        super().__init__()
        # Network structure, a simple two-layer fully connected network, each layer is followed by LIF neurons
        self.fc = nn.Sequential(
            nn.Flatten(),
            nn.Linear(28 * 28, 14 * 14, bias=False),
            neuron.LIFNode(tau=tau, v_threshold=v_threshold, v_reset=v_reset),
            nn.Linear(14 * 14, 10, bias=False),
            neuron.LIFNode(tau=tau, v_threshold=v_threshold, v_reset=v_reset)
        )

    def forward(self, x):
        return self.fc(x)

This simple network with a Poisson encoder can achieve 92% accuracy on MNIST test dataset. Read the tutorial of clock driven for more details. You can also run this code in Python terminal for training on classifying MNIST:

>>> import spikingjelly.clock_driven.examples.lif_fc_mnist as lif_fc_mnist
>>> lif_fc_mnist.main()

Read spikingjelly.clock_driven.examples to explore more advanced networks!

Device Supports

  • Nvidia GPU
  • CPU

As simple as using PyTorch.

>>> net = nn.Sequential(nn.Flatten(), nn.Linear(28 * 28, 10, bias=False), neuron.LIFNode(tau=tau))
>>> net = net.to(device) # Can be CPU or CUDA devices

About

Multimedia Learning Group, Institute of Digital Media (NELVT), Peking University is the main developer of SpikingJelly.

The list of developers can be found here.

Any contributions to SpikingJelly is welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spikingjelly-0.0.0.0.2.tar.gz (90.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spikingjelly-0.0.0.0.2-py3-none-any.whl (139.3 kB view details)

Uploaded Python 3

File details

Details for the file spikingjelly-0.0.0.0.2.tar.gz.

File metadata

  • Download URL: spikingjelly-0.0.0.0.2.tar.gz
  • Upload date:
  • Size: 90.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for spikingjelly-0.0.0.0.2.tar.gz
Algorithm Hash digest
SHA256 62c357a261c1833bc1358aeb4acadd1d605217c4f7ffd1b2502272e70c0fd3ba
MD5 0e981b1fcd04eac7a562d9021f578467
BLAKE2b-256 ef8ab2cb83100755729c12922b6b125508ad8fe7cd0647b6ebbe23cd8da891e8

See more details on using hashes here.

File details

Details for the file spikingjelly-0.0.0.0.2-py3-none-any.whl.

File metadata

  • Download URL: spikingjelly-0.0.0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 139.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for spikingjelly-0.0.0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9691f1bedc84d53c47a74600db2ff7b567acc8bebf773cef27996493dec8ec63
MD5 213998a4ab57628ef24a57806af16416
BLAKE2b-256 a37ae4196750ee4a019d4a002676a5e50f30d153e47f9bdd990a4082b4f28df3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page