Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSM wrapper #357

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from
Open

Conversation

Chase-Grajeda
Copy link
Contributor

Implements a wrapper to run a Mamba SummaryNetwork with BayesFlow

  • Current implementation is locked to Torch backends only given fundamental constraints.
  • Nvidia GPUs are highly recommended; AMD cards have extra setup required for compatibility.
  • CPU is not supported.

https://github.com/state-spaces/mamba

Chase-Grajeda and others added 18 commits February 4, 2025 10:12
Added wrappers folder.
Added Mamba SummaryNetwork wrapper.
Added necessary __init__ files.
Added MambaSSM docstring.
Added try-catch for Mamba import to remove hard dependence.
Added docstring for MambaSSM.
Added custom parameters for MambaSSM.
Removed (temp) serializable decorator and import from MambaSSM.
Added mamba_version arg to MambaSSM constructor.
Added mamba_blocks arg to MambaSSM constructor.
Reordered args in MambaSSM constructor.
Updated docstring for MambaSSM.
Added block generation and version handling to MambaSSM wrapper.
Updated LV benchmark docstring.
Added necessary device spec to Mamba generator.
Added activation between Mamba blocks.
Switched ReLU to Sigmoid activation. ReLU caused exploding gradients
Switched activation to softplus
Switched activation to log1exp
Removed activations.
Added dt_min, dt_max args
Fixed py syntax error
Added LayerNorm to Mamba blocks
Reorder layerNorm and SSM operation
Added soft scaling after mamba pass
Replaced generator with specific mamba constructors due to new input args.
Added new hidden ssm dim arg.
Removed mamba2 support due to instability
Removed file that will be later renamed on dev
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 35.48387% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bayesflow/wrappers/mamba/mamba.py 31.03% 20 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
bayesflow/__init__.py 100.00% <ø> (ø)
.../simulators/benchmark_simulators/lotka_volterra.py 21.62% <ø> (ø)
bayesflow/wrappers/__init__.py 100.00% <100.00%> (ø)
bayesflow/wrappers/mamba/__init__.py 100.00% <100.00%> (ø)
bayesflow/wrappers/mamba/mamba.py 31.03% <31.03%> (ø)
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Updated mamba block init for linting rules
Additional updates from ruff
@stefanradev93
Copy link
Contributor

Great, Chase! Can you merge dev into your branch and make sure the tests are running. Also, no need to change the SIR notebook (revert to default), since we will take one of your upcoming notebooks as an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants