LUNA / README.md
bruAristimunha's picture
Replace with clean markdown card
3f21c41 verified
---
license: bsd-3-clause
library_name: braindecode
pipeline_tag: feature-extraction
tags:
- eeg
- biosignal
- pytorch
- neuroscience
- braindecode
- foundation-model
- convolutional
---
# LUNA
LUNA from Döner et al [LUNA].
> **Architecture-only repository.** Documents the
> `braindecode.models.LUNA` class. **No pretrained weights are
> distributed here.** Instantiate the model and train it on your own
> data.
## Quick start
```bash
pip install braindecode
```
```python
from braindecode.models import LUNA
model = LUNA(
n_chans=22,
sfreq=250,
input_window_seconds=4.0,
n_outputs=4,
)
```
The signal-shape arguments above are illustrative defaults — adjust to
match your recording.
## Documentation
- Full API reference: <https://braindecode.org/stable/generated/braindecode.models.LUNA.html>
- Interactive browser (live instantiation, parameter counts):
<https://huggingface.co/spaces/braindecode/model-explorer>
- Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/luna.py#L30>
## Architecture
![LUNA architecture](https://arxiv.org/html/2510.22257v1/x1.png)
## Parameters
| Parameter | Type | Description |
|---|---|---|
| `patch_size` | int | Number of time samples per patch. Default: 40. |
| `num_queries` | int | Number of learned queries for channel unification. Paper uses: 4 (Base), 6 (Large), 8 (Huge). Default: 4. |
| `embed_dim` | int | Embedding dimension for patch features. Paper uses: 64 (Base), 96 (Large), 128 (Huge). Default: 64. |
| `depth` | int | Number of transformer encoder blocks. Paper uses: 8 (Base), 10 (Large), 24 (Huge). Default: 8. |
| `num_heads` | int | Number of attention heads in channel unification. Default: 2. |
| `mlp_ratio` | float | Ratio of MLP hidden dimension to embedding dimension. Default: 4.0. |
| `norm_layer` | nn.Module | Normalization layer class. Default: nn.LayerNorm. |
| `drop_path` | float | Stochastic depth rate. Default: 0.0. |
## References
1. Döner, B., Ingolfsson, T. M., Benini, L., & Li, Y. (2025). LUNA: Efficient and Topology-Agnostic Foundation Model for EEG Signal Analysis. The Thirty-Ninth Annual Conference on Neural Information Processing Systems - NeurIPS. Retrieved from https://openreview.net/forum?id=uazfjnFL0G
## Citation
Cite the original architecture paper (see *References* above) and braindecode:
```bibtex
@article{aristimunha2025braindecode,
title = {Braindecode: a deep learning library for raw electrophysiological data},
author = {Aristimunha, Bruno and others},
journal = {Zenodo},
year = {2025},
doi = {10.5281/zenodo.17699192},
}
```
## License
BSD-3-Clause for the model code (matching braindecode).
Pretraining-derived weights, if you fine-tune from a checkpoint,
inherit the licence of that checkpoint and its training corpus.