Skip to main content

An extension to PyTorch: SNN layers that function on traces.

Project description

traceTorch Banner

License PyPI

traceTorch is a PyTorch-based library built on the principles of spiking neural networks, replacing the PyTorch default backpropagation through time with lightweight, per-layer input traces, enabling biologically inspired, constant time and memory consumption learning on arbitrarily long or even streaming sequences.

Documentation

It is highly recommended that you read the documentation first. It contains:

  1. Introduction: An introduction to traceTorch, how and why it works, it's founding principles. It's thoroughly recommended that you read through the entire introduction and gain an intuitive understanding before proceeding.
  2. Tutorials: Various tutorials to create your own traceTorch models. The resultant code can be found in tutorials/.
  3. Documentation: The actual documentation to all the modules included in traceTorch. It includes detailed explanations, examples and math to gain a full understanding.

Roadmap

  • Create the poisson click test example
  • Implement the trace alternative to REINFORCE
  • Finish writing the documentation
  • Move tutorial code to separate repository
  • Implement abstract graph based models, not just sequential

Installation

traceTorch is a PyPI library, which can be found here.

You can install it via pip. All the required packages for it to work are also downloaded automatically.

pip install tracetorch

To use, simply do:

import tracetorch

Usage examples

tutorials/ contains all the tutorial files, ready to run and playtest. The tutorials themselves can be found here.

The tutorials make use of libraries that tracetorch doesn't necessarily use. To ensure that you have all the necessary packages for the tutorials installed, please install the packages listed in tutorials/requirements.txt

cd tutorials/
pip install -r requirements.txt

It's recommended to use an environment that does not have tracetorch installed if using the tutorials, tracetorch/ is structured identically to the library, but is of course a running release.

Authors

Acknowledgements

I built traceTorch from the ground up, trying to reverse engineer biological neurons with a sprinkle of intelligent design, but I would also like to recognize the following projects and people who helped shape my thinking:

  • snntorch for introducing me to SNN networks in the first place, and their principles of function. Ironically, its dependency on constructing the full autograd graph is what largely inspired me to make traceTorch.
  • Artem Kirsanov for introducing me to computational neuroscience, presenting interesting concepts in an easy-to-understand manner. My earliest tests, when I naively wanted to implement 1:1 biological neurons, largely revolved around his work.
  • e-prop (eligibility propagation) inspired the whole "trace" concept, the idea of keeping a decaying value. Earlier, before traceTorch, I wanted to use e-prop for online learning instead. Admittedly unsuccessful in my attempts, and a little put off by the relative difficulty, I instead wanted to make something simpler.

Contributing

Contributions are always welcome. Feel free to submit pull requests or report issues, I will occasionally check in on it.

You can also reach out to me via either email or Twitter:

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

tracetorch-0.2.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

tracetorch-0.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file tracetorch-0.2.0.tar.gz.

File metadata

  • Download URL: tracetorch-0.2.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for tracetorch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f5b8fa907b93b6e71377b795de30932a99b82062ac98ee8b7e9d20acaafd4cff
MD5 42e5635fe91090c68aed7faa9c4f49a3
BLAKE2b-256 5c48263e8642dd6fac2a95c93ff7bc4798905fec8102938b8c710884008c933b

See more details on using hashes here.

File details

Details for the file tracetorch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tracetorch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for tracetorch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 588e7e7e9ba40f99dbc6d0a2e8d100afae9b793b865e554598561e63b159dee8
MD5 4edad1ab3f1e26b0f319cf0b568677b5
BLAKE2b-256 31a63070865884261c933ff736d65185b943db957af95a42f08c93e445251b5d

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