Views
No views yet
braindecode.models.SignalJEPA.config.json so they can be loaded in one line with
YourModelClass.from_pretrained(repo_id, ...).| repo ID | channel embedding included | when to use |
|---|---|---|
braindecode/signal-jepa | ✓ 62-row _ChannelEmbedding aligned with the pre-training layout | your recording channels are a subset (by name, case-insensitive) of the 62 pre-training channels — you want to reuse the learned spatial embeddings |
braindecode/signal-jepa_without-chans | ✗ only the SSL backbone (feature encoder + transformer) | your channels are not a subset of the pre-training set, or you prefer to train channel embeddings from scratch |
braindecode/signal-jepa_without-chans: it
always works, regardless of your electrode layout.1from braindecode.models import SignalJEPA
2
3# With the pre-trained channel embeddings (recording channels ⊂ pre-train set):
4model = SignalJEPA.from_pretrained("braindecode/signal-jepa")
5
6# Or: with your own channels, kept aligned to the pre-training embedding table
7model = SignalJEPA.from_pretrained(
8 "braindecode/signal-jepa",
9 chs_info=raw.info["chs"], # subset of the 62 pre-training channels
10 channel_embedding="pretrain_aligned",
11)
12
13# Or: without pre-trained channel embeddings (any electrode layout):
14model = SignalJEPA.from_pretrained(
15 "braindecode/signal-jepa_without-chans",
16 chs_info=raw.info["chs"],
17 strict=False, # the channel-embedding weight is intentionally missing
18)strict=False so from_pretrained does not
complain about those missing keys.1from braindecode.models import (
2 SignalJEPA_Contextual,
3 SignalJEPA_PreLocal,
4 SignalJEPA_PostLocal,
5)
6
7# a) Contextual — keeps the transformer
8model = SignalJEPA_Contextual.from_pretrained(
9 "braindecode/signal-jepa", # or "signal-jepa_without-chans"
10 n_times=256, # e.g. 2 s at 128 Hz
11 n_outputs=4,
12 strict=False, # ignore un-trained classification head
13)
14
15# b) Post-local — transformer discarded
16model = SignalJEPA_PostLocal.from_pretrained(
17 "braindecode/signal-jepa_without-chans",
18 n_chans=19,
19 n_times=256,
20 n_outputs=4,
21 strict=False,
22)
23
24# c) Pre-local — transformer discarded
25model = SignalJEPA_PreLocal.from_pretrained(
26 "braindecode/signal-jepa_without-chans",
27 n_chans=19,
28 n_times=256,
29 n_outputs=4,
30 strict=False,
31)skorch.EEGClassifier.SignalJEPA and SignalJEPA_Contextual accept a channel_embedding kwarg:"scratch" (default): the _ChannelEmbedding table has one row per user
channel, initialized from chs_info. Compatible with the
without-chans checkpoint."pretrain_aligned": the table has 62 rows in the pre-training order,
forward indexes into the subset matching your chs_info (matched by
channel name, case-insensitive). Compatible with the full checkpoint.from_pretrained picks the right mode automatically based on the checkpoint's
config.json; override with the channel_embedding= kwarg if needed.1@article{guetschel2024sjepa,
2 title = {S-JEPA: towards seamless cross-dataset transfer
3 through dynamic spatial attention},
4 author = {Guetschel, Pierre and Moreau, Thomas and Tangermann, Michael},
5 journal = {arXiv preprint arXiv:2403.11772},
6 year = {2024},
7}