mamba-minimal  by johnma2006

Minimal Mamba SSM implementation in one PyTorch file

created 1 year ago
2,839 stars

Top 17.1% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a simplified, single-file PyTorch implementation of the Mamba selective state space model architecture. It is intended for researchers and developers who want to understand Mamba's core mechanics without the complexities of the highly optimized official implementation. The primary benefit is enhanced code readability and educational value.

How It Works

The implementation focuses on clarity, replicating the numerical output of the official Mamba model for both forward and backward passes. It prioritizes straightforward PyTorch operations over performance optimizations, making the underlying algorithms more accessible for study.

Quick Start & Requirements

  • Install via pip install torch transformers.
  • Requires PyTorch and Hugging Face Transformers.
  • Demo notebook demo.ipynb showcases prompt completion.

Highlighted Details

  • Numerically equivalent to the official Mamba implementation.
  • Single-file, annotated PyTorch code for readability.
  • Does not include performance optimizations from the official release.

Maintenance & Community

This is a personal project by johnma2006, focused on educational purposes. There is no explicit mention of community channels or ongoing maintenance plans.

Licensing & Compatibility

The repository does not explicitly state a license. Given its nature as a minimal implementation derived from the official Mamba project, users should consult the license of the original Mamba repository for usage and compatibility guidelines, especially for commercial applications.

Limitations & Caveats

This implementation is explicitly not optimized for speed and is intended for educational purposes rather than production deployment. It may lack features or robustness found in the official, highly optimized Mamba codebase.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
73 stars in the last 90 days

Explore Similar Projects

Starred by George Hotz George Hotz(Author of tinygrad; Founder of the tiny corp, comma.ai), Shawn Wang Shawn Wang(Editor of Latent Space), and
9 more.

mamba by state-spaces

0.4%
16k
Mamba SSM architecture for sequence modeling
created 1 year ago
updated 2 weeks ago
Feedback? Help us improve.