{"id":15601055,"url":"https://github.com/lucidrains/light-recurrent-unit-pytorch","last_synced_at":"2025-10-14T05:06:14.670Z","repository":{"id":255361518,"uuid":"849359935","full_name":"lucidrains/light-recurrent-unit-pytorch","owner":"lucidrains","description":"Implementation of a Light Recurrent Unit in Pytorch","archived":false,"fork":false,"pushed_at":"2024-10-06T17:44:18.000Z","size":36705,"stargazers_count":47,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T11:08:45.971Z","etag":null,"topics":["artificial-intelligence","deep-learning","recurrent-neural-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucidrains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-29T13:06:30.000Z","updated_at":"2025-02-24T18:26:38.000Z","dependencies_parsed_at":"2024-08-29T14:41:43.338Z","dependency_job_id":"004aea90-eff4-425a-b577-30c1b62582db","html_url":"https://github.com/lucidrains/light-recurrent-unit-pytorch","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"e05feb41156a4a2700a4a0468adafe30862c4c34"},"previous_names":["lucidrains/light-recurrent-unit-pytorch"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Flight-recurrent-unit-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Flight-recurrent-unit-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Flight-recurrent-unit-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Flight-recurrent-unit-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/light-recurrent-unit-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036064,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","deep-learning","recurrent-neural-networks"],"created_at":"2024-10-03T02:13:19.182Z","updated_at":"2025-10-14T05:06:14.664Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./lru.png\" width=\"400px\"\u003e\u003c/img\u003e\n\n## Light Recurrent Unit - Pytorch\n\nImplementation of the \u003ca href=\"https://www.mdpi.com/2079-9292/13/16/3204\"\u003eLight Recurrent Unit\u003c/a\u003e in Pytorch\n\n## Install\n\n```bash\n$ pip install light-recurrent-unit-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnitCell\n\ncell = LightRecurrentUnitCell(256)\n\nx = torch.randn(2, 256)\nhidden = torch.randn(2, 256)\n\nnext_hidden = cell(x, hidden) # (2, 256)\n```\n\nSingle layer\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnitLayer\n\nlayer = LightRecurrentUnitLayer(256)\n\nx = torch.randn(2, 1024, 256)\n\nout = layer(x) # (2, 1024, 256)\n\nassert out.shape == x.shape\n```\n\nStacked\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnit\n\nlru = LightRecurrentUnit(256, depth = 4)\n\nx = torch.randn(2, 1024, 256)\n\nout, layer_hiddens = lru(x) # (2, 1024, 256), List[(2, 256)]\n\nassert out.shape == x.shape\n```\n\n## Test\n\nEnwik8\n\n```bash\n$ python train.py\n```\n\n## Citations\n\n```bibtex\n@Article{electronics13163204,\n    AUTHOR  = {Ye, Hong and Zhang, Yibing and Liu, Huizhou and Li, Xuannong and Chang, Jiaming and Zheng, Hui},\n    TITLE   = {Light Recurrent Unit: Towards an Interpretable Recurrent Neural Network for Modeling Long-Range Dependency},\n    JOURNAL = {Electronics},\n    VOLUME  = {13},\n    YEAR    = {2024},\n    NUMBER  = {16},\n    ARTICLE-NUMBER = {3204},\n    URL     = {https://www.mdpi.com/2079-9292/13/16/3204},\n    ISSN    = {2079-9292},\n    DOI     = {10.3390/electronics13163204}\n}\n```\n\n```bibtex\n@article{Merrill2024TheIO,\n    title   = {The Illusion of State in State-Space Models},\n    author  = {William Merrill and Jackson Petty and Ashish Sabharwal},\n    journal = {ArXiv},\n    year    = {2024},\n    volume  = {abs/2404.08819},\n    url     = {https://api.semanticscholar.org/CorpusID:269149086}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Flight-recurrent-unit-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Flight-recurrent-unit-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Flight-recurrent-unit-pytorch/lists"}