SleepFM โ pretrained encoder
Mirror of the official SleepFM encoder checkpoint, re-hosted for stable loading from Braindecode.
SleepFM is a multimodal polysomnography (PSG) foundation model introduced in:
R. Thapa et al., "A multimodal sleep foundation model for disease prediction," Nature Medicine (2026). https://doi.org/10.1038/s41591-025-04133-4
The downstream sleep stager lives in a separate repository,
braindecode/SleepFMStager,
because a Braindecode config.json describes exactly one architecture.
Files
| File | Description |
|---|---|
model.safetensors |
The encoder, with the parameter names of braindecode.models.SleepFM |
config.json |
Architecture of the checkpoint, read by from_pretrained() |
model_base/best.pt |
The upstream artifact, byte-for-byte, kept for provenance |
model_sleep_staging/best.pth |
The upstream staging artifact, byte-for-byte (see SleepFMStager) |
model.safetensors holds the same tensors as model_base/best.pt; only the keys were
rewritten (the module. prefix of the distributed training run stripped, and
positional_encoding.pe renamed) so that the library needs no remapping code at load
time. Loading either way gives bit-identical outputs.
Note that the released encoder is contrastive and carries no classification head:
final_layer is randomly initialised and must be fine-tuned.
Training data
The data that shaped these weights. The ids are the datasets: field of this card,
which braindecode reads into model.card_data.datasets when you call
from_pretrained (MOABB class names for MOABB datasets, OpenNeuro / NEMAR
accessions, Hub ids otherwise). nm/on ids are datasets on NEMAR
(on = NEMAR's copy of the OpenNeuro dataset with the same number). Rows marked
private: are data the authors did not release; they are not in datasets:.
datasets: id |
Dataset | Stage | Modality |
|---|---|---|---|
SSC |
Stanford Sleep Clinic PSG cohort (Stanford Sleep Dataset) | pretraining | PSG |
private:BioSerenity |
BioSerenity / SleepMed proprietary PSG collection (18,869 overnight recordings) | pretraining | PSG |
MESA |
Multi-Ethnic Study of Atherosclerosis (sleep ancillary, NSRR) | pretraining | PSG |
MrOS |
Outcomes of Sleep Disorders in Older Men (MrOS Sleep, NSRR) | pretraining | PSG |
- Leave-one-out multimodal contrastive pretraining on the 'pretrain' split of the four cohorts (>585,000 h, ~65,000 participants); SHHS explicitly held out. Upstream model_base/config.json: mode=leave_one_out, epochs=1.
- Sources: Thapa et al., Nature Medicine 2026, doi:10.1038/s41591-025-04133-4, Results 'Dataset and SleepFM architecture'; https://github.com/zou-group/sleepfm-clinical README (main); braindecode SleepFM docstring (W/bd/braindecode/models/sleepfm.py).
Usage
from braindecode.models import SleepFM
# Defaults to this repository.
model = SleepFM.from_pretrained(n_chans=4, n_outputs=5, n_times=3840, sfreq=128)
model.eval()
Input must be sampled at 128 Hz; the reference patch_size=640 is a 5-second patch at
that rate. A channel mask of shape (batch, n_chans) marks missing channels with True.
License & attribution
- License: Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).
- Copyright (c) 2025 Rahul Thapa.
- Upstream source: https://github.com/zou-group/sleepfm-clinical
These weights are not covered by Braindecode's BSD-3 license and inherit the upstream noncommercial terms. Re-hosted for reproducibility and stable availability only; attribution and the CC BY-NC 4.0 restriction are preserved.
Cite Braindecode
If you use this braindecode port in scientific work, cite the software on Zenodo, doi:10.5281/zenodo.17699192, and the original model and datasets cited above.
@software{braindecode,
author = {Aristimunha, Bruno and
Guetschel, Pierre and
Wimpff, Martin and
Gemein, Lukas and
Rommel, Cedric and
Banville, Hubert and
Sliwowski, Maciej and
Wilson, Daniel and
Brandt, Simon and
Gnassounou, Thรฉo and
Paillard, Joseph and
{Junqueira Lopes}, Bruna and
Sedlar, Sara and
Moreau, Thomas and
Chevallier, Sylvain and
Gramfort, Alexandre and
Schirrmeister, Robin Tibor},
title = {Braindecode: toolbox for decoding raw electrophysiological brain data
with deep learning models},
url = {https://github.com/braindecode/braindecode},
doi = {10.5281/zenodo.17699192},
publisher = {Zenodo},
license = {BSD-3-Clause},
}
- Downloads last month
- 555