{"id":13444489,"url":"https://github.com/johnma2006/mamba-minimal","last_synced_at":"2025-05-15T07:02:27.502Z","repository":{"id":213351905,"uuid":"733879158","full_name":"johnma2006/mamba-minimal","owner":"johnma2006","description":"Simple, minimal implementation of the Mamba SSM in one file of PyTorch.","archived":false,"fork":false,"pushed_at":"2024-03-08T04:13:40.000Z","size":49,"stargazers_count":2770,"open_issues_count":19,"forks_count":206,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-14T10:42:42.437Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnma2006.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":"2023-12-20T10:39:47.000Z","updated_at":"2025-04-13T20:31:25.000Z","dependencies_parsed_at":"2023-12-26T02:20:48.569Z","dependency_job_id":"dd5892d3-e11f-4c36-9dc9-e47053fa076f","html_url":"https://github.com/johnma2006/mamba-minimal","commit_stats":null,"previous_names":["johnma2006/mamba-minimal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnma2006%2Fmamba-minimal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnma2006%2Fmamba-minimal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnma2006%2Fmamba-minimal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnma2006%2Fmamba-minimal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnma2006","download_url":"https://codeload.github.com/johnma2006/mamba-minimal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254291961,"owners_count":22046424,"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":[],"created_at":"2024-07-31T04:00:26.058Z","updated_at":"2025-05-15T07:02:27.474Z","avatar_url":"https://github.com/johnma2006.png","language":"Python","funding_links":[],"categories":["Input-dependent gating.","Python","A01_文本生成_文本对话","Repos","Mamba"],"sub_categories":["大语言对话模型及数据"],"readme":"## mamba-minimal\n\nSimple, minimal implementation of Mamba in one file of PyTorch.\n\nFeaturing:\n* Equivalent numerical output as official implementation for both forward and backward pass\n* Simplified, readable, annotated code\n\nDoes NOT include:\n* Speed. The official implementation is heavily optimized, and these optimizations are core contributions of the Mamba paper. I kept most implementations simple for readability.\n* Proper parameter initialization (though this could be added without sacrificing readability)\n\n## Demo\n\nSee [demo.ipynb](demo.ipynb) for examples of prompt completions.\n\n```python\nfrom model import Mamba\nfrom transformers import AutoTokenizer\n\nmodel = Mamba.from_pretrained('state-spaces/mamba-370m')\ntokenizer = AutoTokenizer.from_pretrained('EleutherAI/gpt-neox-20b')\n\ngenerate(model, tokenizer, 'Mamba is the')\n```\n\u003e Mamba is the world's longest venomous snake with an estimated length of over 150 m. With such a large size and a venomous bite, Mamba kills by stabbing the victim (which is more painful and less effective than a single stab of the bite)\n\n150 meters... 🫢 scary!\n\n## References\n\nThe Mamba architecture was introduced in [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](https://arxiv.org/abs/2312.00752) by [Albert Gu](https://twitter.com/_albertgu?lang=en) and [Tri Dao](https://twitter.com/tri_dao?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor).\n\nThe official implementation is here: https://github.com/state-spaces/mamba/tree/main\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnma2006%2Fmamba-minimal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnma2006%2Fmamba-minimal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnma2006%2Fmamba-minimal/lists"}