popt_brainbert_stft checkpoint, remapped so it loads directly with
braindecode.models.PopulationTransformer.stft features, 768-d) — and PopT aggregates across
the electrode population. Each electrode feature is linearly projected and given
a fixed sinusoidal spatial position encoding built from its integer
anatomical coordinates; a CLS token is prepended, a stack of Transformer
encoder layers mixes the population, and the CLS output is the pooled
representation used downstream.| Original code | https://github.com/czlwang/PopulationTransformer |
| Original weights | https://huggingface.co/PopulationTransformer/popt_brainbert_stft |
| Paper | Chau et al. (2024), Population Transformer: Learning Population-level Representations of Neural Activity, arXiv:2406.03044 |
PtModelCustom output to < 1e-5). The
upstream masked-modelling heads (cls_head, token_cls_head) are not
carried; the braindecode classification head (final_layer) is
randomly initialised and must be trained/fine-tuned for your task.| param | value |
|---|---|
hidden_dim | 512 |
ffn_dim | 2048 |
n_layers | 6 |
n_heads | 8 |
n_times (feature dim) | 768 |
max_len (coord table) | 5000 |
| activation | GELU |
| parameters (encoder + spec head) | ~20.6M |
1import torch
2from braindecode.models import PopulationTransformer
3
4# n_chans = number of electrodes; n_outputs = your task's classes.
5model = PopulationTransformer.from_pretrained(
6 "braindecode/popt-pretrained", n_outputs=2
7)
8
9# input = per-electrode features (e.g. frozen BrainBERT stft embeddings),
10# shape (batch, n_electrodes, 768). Electrode coordinates are read from
11# chs_info when available, otherwise fall back to sequential indices.
12x = torch.randn(4, 64, 768)
13logits = model(x) # (4, n_outputs)
14cls = model(x, return_features=True) # {"features": ..., "cls_token": ...}n_outputs (the head is
re-initialised) and fine-tune. Electrode positions can be provided through
chs_info (their loc) so the spatial encoding reflects the real montage.unknown. They are re-hosted here
for research use with attribution; if you use them, cite the original work and
respect any terms the authors may later publish. The braindecode code is
BSD-3-Clause.1@article{chau2024population,
2 title={Population Transformer: Learning Population-level Representations of Neural Activity},
3 author={Chau, Geeling and Wang, Christopher and Talukder, Sabera and Subramaniam, Vighnesh and Soedarmadji, Saraswati and Yue, Yisong and Katz, Boris and Barbu, Andrei},
4 journal={arXiv preprint arXiv:2406.03044},
5 year={2024}
6}