| --- |
| license: cc-by-nc-4.0 |
| library_name: braindecode |
| tags: |
| - eeg |
| - polysomnography |
| - sleep |
| - foundation-model |
| - braindecode |
| --- |
| |
| # SleepFM — pretrained checkpoints |
|
|
| Mirror of the official **SleepFM** checkpoints, re-hosted for stable loading from |
| [Braindecode](https://github.com/braindecode/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 |
|
|
| ## Files |
|
|
| | File | Description | Used by | |
| |------|-------------|---------| |
| | `model_base/best.pt` | Pretrained channel-agnostic PSG encoder (backbone) | `SleepFM.load_pretrained_backbone`, `SleepFMStager.load_pretrained_backbone` | |
| | `model_sleep_staging/best.pth` | Downstream sleep-staging head | `SleepFMStager.load_pretrained_staging_head` | |
|
|
| These are byte-for-byte copies of the upstream artifacts; only the hosting location |
| changed. The layout (`model_base/`, `model_sleep_staging/`) mirrors the upstream repo. |
|
|
| ## Usage |
|
|
| ```python |
| import torch |
| from braindecode.models import SleepFMStager |
| |
| base = torch.hub.load_state_dict_from_url( |
| "https://huggingface.co/braindecode/SleepFM/resolve/main/model_base/best.pt", |
| map_location="cpu", |
| ) |
| staging = torch.hub.load_state_dict_from_url( |
| "https://huggingface.co/braindecode/SleepFM/resolve/main/model_sleep_staging/best.pth", |
| map_location="cpu", |
| ) |
| |
| model = SleepFMStager(n_chans=4, n_outputs=5, n_times=3840, sfreq=128) |
| model.load_pretrained_backbone(base) |
| model.load_pretrained_staging_head(staging) |
| model.eval() |
| ``` |
|
|
| ## 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. |
|
|