Add SleepFM pretrained checkpoints (base + sleep-staging head), CC BY-NC 4.0
Browse files- README.md +61 -0
- model_base/best.pt +3 -0
- model_sleep_staging/best.pth +3 -0
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
library_name: braindecode
|
| 4 |
+
tags:
|
| 5 |
+
- eeg
|
| 6 |
+
- polysomnography
|
| 7 |
+
- sleep
|
| 8 |
+
- foundation-model
|
| 9 |
+
- braindecode
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# SleepFM — pretrained checkpoints
|
| 13 |
+
|
| 14 |
+
Mirror of the official **SleepFM** checkpoints, re-hosted for stable loading from
|
| 15 |
+
[Braindecode](https://github.com/braindecode/braindecode).
|
| 16 |
+
|
| 17 |
+
SleepFM is a multimodal polysomnography (PSG) foundation model introduced in:
|
| 18 |
+
|
| 19 |
+
> R. Thapa et al., *"A multimodal sleep foundation model for disease prediction,"*
|
| 20 |
+
> **Nature Medicine** (2026). https://doi.org/10.1038/s41591-025-04133-4
|
| 21 |
+
|
| 22 |
+
## Files
|
| 23 |
+
|
| 24 |
+
| File | Description | Used by |
|
| 25 |
+
|------|-------------|---------|
|
| 26 |
+
| `model_base/best.pt` | Pretrained channel-agnostic PSG encoder (backbone) | `SleepFM.load_pretrained_backbone`, `SleepFMStager.load_pretrained_backbone` |
|
| 27 |
+
| `model_sleep_staging/best.pth` | Downstream sleep-staging head | `SleepFMStager.load_pretrained_staging_head` |
|
| 28 |
+
|
| 29 |
+
These are byte-for-byte copies of the upstream artifacts; only the hosting location
|
| 30 |
+
changed. The layout (`model_base/`, `model_sleep_staging/`) mirrors the upstream repo.
|
| 31 |
+
|
| 32 |
+
## Usage
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import torch
|
| 36 |
+
from braindecode.models import SleepFMStager
|
| 37 |
+
|
| 38 |
+
base = torch.hub.load_state_dict_from_url(
|
| 39 |
+
"https://huggingface.co/braindecode/SleepFM/resolve/main/model_base/best.pt",
|
| 40 |
+
map_location="cpu",
|
| 41 |
+
)
|
| 42 |
+
staging = torch.hub.load_state_dict_from_url(
|
| 43 |
+
"https://huggingface.co/braindecode/SleepFM/resolve/main/model_sleep_staging/best.pth",
|
| 44 |
+
map_location="cpu",
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
model = SleepFMStager(n_chans=4, n_outputs=5, n_times=3840, sfreq=128)
|
| 48 |
+
model.load_pretrained_backbone(base)
|
| 49 |
+
model.load_pretrained_staging_head(staging)
|
| 50 |
+
model.eval()
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## License & attribution
|
| 54 |
+
|
| 55 |
+
- **License: Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).**
|
| 56 |
+
- Copyright (c) 2025 Rahul Thapa.
|
| 57 |
+
- Upstream source: https://github.com/zou-group/sleepfm-clinical
|
| 58 |
+
|
| 59 |
+
These weights are **not** covered by Braindecode's BSD-3 license and inherit the
|
| 60 |
+
upstream **noncommercial** terms. Re-hosted for reproducibility and stable
|
| 61 |
+
availability only; attribution and the CC BY-NC 4.0 restriction are preserved.
|
model_base/best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffc9fc10233ebc4d0aae71abce87070db51b8bac6e4b16a5c1b4401a5f73f799
|
| 3 |
+
size 19444020
|
model_sleep_staging/best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a742faf4dd9a1f5ebcccc464894081480217e683974750eb3f10e6c4d1b0fde9
|
| 3 |
+
size 9351915
|