Expand description
§lumamba-rs — LuMamba EEG foundation-model inference in Rust
Pure-Rust inference for LuMamba (PulpBio/LuMamba,
from BioFoundation), built on the
RLX compiler/runtime.
LuMamba reuses LUNA’s topology-invariant front-end — variable-channel EEG is compressed into a fixed set of learned queries by cross-attention — and replaces LUNA’s rotary Transformer encoder with a stack of bidirectional Mamba (FEMBA) blocks that run in linear time over the patch sequence.
EEG (B, C, T)
├─ PatchEmbed (3× Conv2d + GroupNorm + GELU) ┐ CPU prepare
└─ FreqEmbed (FFT magnitude/phase → MLP) ├─ (host)
→ + NeRF channel-location embedding ┘
→ CrossAttention channel unification (C → Q queries) ┐
→ reshape [B, S, Q·E] │ RLX graph
→ N × { LayerNorm → BiMamba(fwd + flip∘rev) → +res } │
→ reconstruction head → (B, C, T) ┘The temporal recurrence runs on RLX’s first-class selective_scan op
(Mamba-1 SSM), the depthwise causal conv on grouped conv2d, and everything
else on the standard graph ops — so the whole model compiles to a single
RLX CompiledGraph per input shape and runs on any RLX backend
(cpu, metal, mlx, cuda, …).
Re-exports§
pub use config::ModelConfig;pub use rlx::ClassifierKind;pub use rlx::EpochEmbedding;pub use rlx::LuMambaEncoder;pub use rlx::RlxEpoch;pub use rlx::RunEpochOpts;pub use channel_positions::bipolar_channel_xyz;pub use channel_positions::channel_xyz;pub use channel_positions::montage_channels;pub use channel_positions::nearest_channel;pub use channel_positions::normalise;pub use channel_positions::MontageLayout;pub use channel_vocab::channel_index;pub use channel_vocab::channel_indices;pub use channel_vocab::channel_indices_unwrap;pub use channel_vocab::CHANNEL_VOCAB;pub use channel_vocab::SEED_CHANNELS;pub use channel_vocab::SIENA_CHANNELS;pub use channel_vocab::TUEG_CHANNELS;pub use channel_vocab::VOCAB_SIZE;
Modules§
- channel_
positions - EEG channel position lookup from embedded standard montage files.
- channel_
vocab - Global channel name vocabulary for LUNA.
- config
- Model and runtime configuration for LuMamba inference.
- eval
- Downstream evaluation harness: load a labeled EEG eval set, run the fine-tuned LuMamba classifier per epoch, optionally aggregate epoch predictions to the recording level, and score with the paper’s metrics.
- hf
- HuggingFace Hub weight resolution.
- metrics
- Classification metrics for downstream evaluation.
- rlx
- RLX-backed LuMamba inference (
rlx::Graph+rlx::Session).
Structs§
- LuMamba
Backends BackendSupportfor the LuMamba model family — the RLX 0.2.10 idiom for declaring which devices a model can execute on, so device validation yields a uniform error instead of a hand-rolledmatchladder.
Constants§
- SUPPORTED_
DEVICES - The RLX backends lumamba-rs forwards Cargo features for. A
--devicetoken outside this set is rejected at parse time byparse_device.
Functions§
- init_
threads - Configure the global Rayon thread pool (used by the CPU prepare path and the RLX CPU backend).
- parse_
device - Parse a
--deviceCLI token into anrlx::Device.