Skip to main content

lru_unofficial

LRU implementation in TensorFlow 2.0. The LRU was introduced in Resurrecting Recurrent Neural Networks for Long Sequences at ICML, and belongs to the state-space models family, which are models able to handle extremely long sequences more gracefully than attention based architectures. You can find here the JAX implementation that we took as a reference, as recommended by one of the authors.

JAX and PyTorch implementations to come. However, parallel scans are not implemented native in PyTorch, as noted here. However custom implementations exist, such as this one.

We implement the LRU unit and also the final LRU residual block used in the paper. For both we provide a recurrent form and a scan form. In our tests, the scan form was up to 300x faster than the recurrent form on a GPU, giving the same output. You can install the package with pip instal lruun. After that, you can import the layers as follows:

from lruun.tf import LinearRecurrentUnitCell, LinearRecurrentUnitFFN
from lruun.tf import ResLRUCell, ResLRUFFN

Release files for lruun 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lruun 0.0.2
File Size Uploaded
lruun-0.0.2.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lruun 0.0.2
File Interpreter ABI Platform
lruun-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / lruun-0.0.2.tar.gz

Download URL lruun-0.0.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
70706ccfad11ad99c70917ae6f7c22052f4c12fb1b0006d4ef98e8bfcd66c41d
BLAKE2b-256 checksum
How to use checksums
0c4e2ba0c0789986d4dfacdeefef6af98a256d23f763a78ee6fe451c0db565b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / lruun-0.0.2-py3-none-any.whl

Download URL lruun-0.0.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
074c552d1e03f2ac8183f699754955561bdf4e357f5878b0c13bbabd876b6748
BLAKE2b-256 checksum
How to use checksums
2ca41d7ff0e9d3c93e14a7783a327de6a36d758390532ac40b44d501d7e4175e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page