PyTorch-based library for the Forward-Forward algorithm
Project description
PyTorch-based library for the Forward-Forward algorithm
FFLib is a neural network library based on PyTorch that aims to implement several different types of layers and networks based on the Forward-Forward algorithm. The library also provides a suite of tools for training, validating, testing, debugging and experimenting with Forward-Forward-based networks. We aim to make this library as close as possible to the original design and structure of the PyTorch library.
Getting Started
Installing dependencies
PyTorch and torchvision are the only main dependencies needed to run all of the examples for now.
We are working on establishing a
requirements.txtfile and acondaenv.
Examples
To get started with our library check out the examples in the ./examples folder.
You can run the examples either from the CLI or from inside VSCode interactively.
We recommend running them from the CLI for the first time, so you can fix any dependency issues
and making interactive execution only afterwards.
The Forward-Forward Algorithm
The Forward-Forward Algorithm was introduced in Geoffrey Hinton's paper "The Forward-Forward Algorithm: Some Preliminary Investigations" with the following abstract:
The aim of this paper is to introduce a new learning procedure for neural networks and to
demonstrate that it works well enough on a few small problems to be worth further investigation.
The Forward-Forward algorithm replaces the forward and backward passes of backpropagation by
two forward passes, one with positive (i.e. real) data and the other with negative data which
could be generated by the network itself. Each layer has its own objective function which is
simply to have high goodness for positive data and low goodness for negative data.
The sum of the squared activities in a layer can be used as the goodness
but there are many other possibilities, including minus the sum of the squared activities.
If the positive and negative passes could be separated in time,
the negative passes could be done offline, which would make the learning much simpler
in the positive pass and allow video to be pipelined through the network without ever
storing activities or stopping to propagate derivatives.
Contributions
We really appreciate contributions from the community! We especially welcome the reports of issues and bugs.
However, one may note that since this library is currently being heavily developed, the API may drastically change and all projects depending on this library have to deal with the changes downstream. We will however try to keep these at minimum.
The main maintainer of this library is Mitko Nikov.
Guidelines
Here are a few guidelines to following while contributing on the library:
- We aim to keep this library with as little run-time-necessary dependencies as possible.
- Unit tests for as many functions as possible. (we know that we can't cover everything)
- Strict Static Type-checking using
mypy - Strict formatting style guidelines (to be configured)
- No recursion (at our abstraction level)
- Nicely documented functions and classes
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fflib-0.1.0.tar.gz.
File metadata
- Download URL: fflib-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
439f48bcecc644327a6aa5748ba3259be8622aa986957628e9ff5ef0a4a3ba8c
|
|
| MD5 |
91f2de7ec26081950b0c4215532ed31a
|
|
| BLAKE2b-256 |
3d0a7c01747e461732f8ab3d341e1ac7de0d18d900f093a2e2d631bf716d728b
|
File details
Details for the file fflib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fflib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
779b163da2cf7494093bbba0a208c159071d1bce34c47d911f17c17d4e44e852
|
|
| MD5 |
23c8ddbb03c43ee8b62ffe7a65299a61
|
|
| BLAKE2b-256 |
9073c8f4c5f6caeb813b9fe8b88df7f4e2c0b727457f1fa7780531d4aad984ff
|