How kaistmm/audio-mamba-aum works
Project type and purpose
• Audio-Mamba (AuM) is a machine-learning project implementing a bidirectional state space model for audio classification.
• It provides code for data loading/processing, model definitions, training orchestration (multi-GPU via Hugging Face Accelerate), experiment scripts, and inference examples.
File structure
Top-level directories and files
• examples/inference – Jupyter notebook and sample data showing how to load a trained model and run inference.
• exps – Predefined experiment folders for each benchmark dataset (AudioSet, Epic-Sounds, VGGSound, etc.). Each contains:
– bash scripts (e.g., aum_eval.sh, training configs)
– data subfolders with class labels and split files
• src – Core Python code:
– dataloader.py – dataset wrapper, spectrogram extraction, augmentations
– src/epic_sounds/epic_data – data loader and config for EPIC-SOUNDS (YAML config, build logic, distributed utils, spec-augment)
– src/models – AST- and Mamba-based model definitions (ast_models.py, mamba_models.py)
– run.py, traintest.py – CLI entry points for training/evaluation
– src/utilities – helper modules (tokenization, stats, utilities)
• vim-mamba_ssm – a vendored copy of the Mamba SSM library (state space operations, triton kernels, module wrappers)
• requirements.txt – Python dependencies
• README.md, LICENSE, .gitignore
README for additional insights
• Dependencies: PyTorch, torchvision, torchaudio, Hugging Face Accelerate, causal_conv1d, mamba_ssm.
• EPIC-SOUNDS uses a special YAML config and a dedicated loader in src/epic_sounds/epic_data.
a. Main components
1. Data Sources
• Benchmark datasets (AudioSet, VGGSound, VoxCeleb, SpeechCommands, EPIC-SOUNDS, etc.)
• Sample WAV files (examples/inference/data)
2. Data Ingestion & Preprocessing
• dataloader.py and epic_data module – waveform loading, spectrogram extraction, spec-augment
3. Core Model
• AuM model classes (src/models/mamba_models.py)
• AST backbone variants (src/models/ast_models.py)
• MambaSSM library (vim-mamba_ssm/mamba_ssm) for state space layers
4. Training Orchestration
• run.py / traintest.py – command-line interface invoking Accelerate for multi-GPU
• exps/*/*.sh – experiment bash scripts setting hyperparameters, dataset paths, output dirs
5. Inference & Evaluation
• examples/inference/inference.ipynb – loading checkpoint, running forward pass on sample audio
• exps/*/aum_eval.sh – dataset-specific evaluation scripts
6. External Services & Artifacts
• Hugging Face Accelerate (multi-GPU distribution)
• PyTorch ecosystem
• Checkpoint storage (Google Drive links)
b. Relationships and interactions
• Data Sources feed into Data Ingestion modules
• Preprocessed features passed to Core Model
• Core Model forwards use MambaSSM components for bidirectional state processing
• Training Orchestration schedules epochs, handles multi-GPU via Accelerate
• Checkpoints written to disk or cloud storage
• Inference modules load checkpoints and mirror the data preprocessing + model forward path
• Experiment scripts wrap run.py/training entry points with dataset-specific configs
c. Architectural patterns and design principles
• Modular separation: data, model, training, utilities, experiments
• Reuse of external libraries – AST code, MambaSSM for SSM operations, Accelerate for distribution
• Config-driven design – YAML for EPIC-SOUNDS, shell scripts for experiments
• CLI-based entry points (run.py, traintest.py) rather than monolithic notebooks
d. Key technologies, frameworks, and libraries
• Python 3.10
• PyTorch / torchvision / torchaudio
• Hugging Face Accelerate
• causal_conv1d, mamba_ssm (state space operations)
• Jupyter (inference notebook)
• Bash for experiment orchestration
Diagramming recommendations
• Annotations for key interactions (e.g., “Accelerate.distributed.launch”, “spec_augment module”).