Skip to content

LRU belongs to the state-space models family, and are able to handle extremely long sequences.

License

Notifications You must be signed in to change notification settings

LuCeHe/lru_unofficial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 install lruun. After that, you can import the layers as follows:

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

About

LRU belongs to the state-space models family, and are able to handle extremely long sequences.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages