{"id":15600978,"url":"https://github.com/lucidrains/mogrifier","last_synced_at":"2025-04-15T16:35:43.596Z","repository":{"id":57442774,"uuid":"277228012","full_name":"lucidrains/mogrifier","owner":"lucidrains","description":"Usable implementation of Mogrifier, a circuit for enhancing LSTMs and potentially other networks, from Deepmind","archived":false,"fork":false,"pushed_at":"2024-06-09T21:54:00.000Z","size":164,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T22:24:32.572Z","etag":null,"topics":["artificial-intelligence","deep-learning","xlstm"],"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":"2020-07-05T04:02:36.000Z","updated_at":"2024-11-24T13:25:09.000Z","dependencies_parsed_at":"2024-06-15T17:00:53.516Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/mogrifier","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"2356f3f9fafb58766e1af4ecf6da05064e0071b6"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fmogrifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fmogrifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fmogrifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fmogrifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/mogrifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109324,"owners_count":21214129,"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","xlstm"],"created_at":"2024-10-03T02:10:50.500Z","updated_at":"2025-04-15T16:35:43.578Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./mogrifier.png\" width=\"600px\"\u003e\u003c/img\u003e\n\n[![PyPI version](https://badge.fury.io/py/mogrifier.svg)](https://badge.fury.io/py/mogrifier)\n\n## Mogrifier\n\nA complete implementation of \u003ca href=\"https://openreview.net/forum?id=SJe5P6EYvS\"\u003eMogrifier\u003c/a\u003e, a circuit for enhancing LSTMs and potentially other networks. It allows two vectors to modulate each other by having each gate the other in an interleaved, iterative fashion.\n\n## Install\n\n```bash\n$ pip install mogrifier\n```\n\n## Usage\n\n```python\nimport torch\nfrom mogrifier import Mogrifier\n\nmogrify = Mogrifier(\n    dim = 512,\n    dim_hidden = 256,\n    iters = 5,          # number of iterations, defaults to 5 as paper recommended for LSTM\n    factorize_k = 16    # factorize weight matrices into (dim x k) and (k x dim), if specified\n)\n\nx = torch.randn(1, 16, 512)\nh = torch.randn(1, 16, 256)\n\nout, hidden_out = mogrify(x, h) # (1, 16, 512), (1, 16, 256)\n\nassert out.shape == x.shape\nassert hidden_out.shape == h.shape\n```\n\n## Citation\n\n```bibtex\n@inproceedings{Melis2020Mogrifier,\n    title   = {Mogrifier LSTM},\n    author  = {Gábor Melis and Tomáš Kočiský and Phil Blunsom},\n    booktitle = {International Conference on Learning Representations},\n    year    = {2020},\n    url     = {https://openreview.net/forum?id=SJe5P6EYvS}\n}\n```\n\n\u003cimg src=\"./transmogrifier.jpg\" width=\"700px\"\u003e\u003c/img\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fmogrifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fmogrifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fmogrifier/lists"}