Skip to content

Integrate new EEG foundation models and supervised baselines #1201

Open

Description

@bruAristimunha

We would like to integrate the following EEG models into Braindecode, and to use them in a systematic study comparing foundation models and supervised baselines under a common evaluation protocol. Each port can get its own PR.

SleepFM (#1106) and CSBrain (#1196) already have open PRs and are not listed here.

We are tagging the authors of the original implementations: your input on checkpoints, preprocessing and licensing would help us integrate your model faithfully.

Proposed first ports

Model Authors Original source Source license Notes
TMSA-Net @Whit3Zhao Whit3Zhao/TMSA-Net MIT Small model in plain PyTorch. The default embedding size is 19 with 4 heads, so attention projects through 16 dimensions (19 → 16 → 19); standard nn.MultiheadAttention does not reproduce this. Local and global attention outputs are summed.
TFM-Tokenizer @Jathurshan0330 Jathurshan0330/TFM-Tokenizer, weights MIT (code and weights) Two parts: a time-frequency VQ tokenizer (STFT at 200 Hz, n_fft=200, hop 100, EMA codebook) and a token classifier. Uses linear attention from linear_attention_transformer. The channel embedding table has 16 slots, so the number of input channels is limited to 16.

Other foundation models

Model Authors Original source Source license Notes
LEAD @YiheWang DL4mHealth/LEAD CC BY-NC-SA 4.0 Channel-flexible model that takes electrode names and sampling rate as inputs. The pretrained checkpoint is linked from the README (Google Drive). The code has changed since publication, so the revision that matches the released checkpoint needs to be identified.
NeuroRVQ @KonstantinosBarmpas KonstantinosBarmpas/NeuroRVQ, weights CC BY-NC 4.0 Already requested in #1090. Suggest porting the EEG foundation model first and the RVQ tokenizer separately.
Uni-DMFM @ichenws ichenws/Uni-DMFM No license file Patch-based model with multi-scale convolutions. Spatial attention reuses the temporal attention projections, and the head flattens the full token grid.
NeuroGPT @wenhui0206 wenhui0206/NeuroGPT, weights GPL-3.0 Conformer encoder over signal chunks followed by a GPT-2 decoder.
mdJPT @soul-M-42 ncclab-sustech/mdJPT_nips2025 No license file Normalization depends on how the batch is grouped, and the model needs an external channel-interpolation file. Both points need to be settled before a standard per-trial forward can be defined.
SleepGPT @LordXX505 LordXX505/SleepGPT No license file Raw PSG foundation model (Huang et al., Nat. Commun. 2026). Fuses time and frequency streams. Requires pinning the large configuration and separating the model from optional Triton/LongNet code.
HEAR (base/large) @Baizhige Code in the ICLR 2026 OpenReview supplement (arXiv:2510.12515) Not stated Channel-flexible model with a learnable coordinate-based spatial embedding over a 1,132-electrode montage. The supplement contains models.py, finetuning.py and the montage file; we did not find public pretrained weights.

Supervised baselines

Model Authors Original source Source license Notes
EEGWaveNet @kkuroma, @IoBT-VISTEC IoBT-VISTEC/EEGWaveNet No license file Small multiscale seizure-detection CNN.
ADFCNN @UM-Tao UM-Tao/ADFCNN-MI No license file The classifier kernel is fixed to 751-sample inputs, and the attention block uses an unusual reshape.
DBConformer @wzwvv wzwvv/DBConformer PolyForm Noncommercial 1.0.0 (stated in README) Two-branch model. Attention is scaled by the full embedding size rather than the per-head size.
SleepTransformer @pquochuy pquochuy/SleepTransformer LICENSE file says MIT; README says CC BY-NC 4.0 TensorFlow 1 sequence-to-sequence model on spectrogram inputs. Needs a sequence-level API.
SleepEEGNet @MousaviSajad MousaviSajad/SleepEEGNet Academic / non-commercial use (README) TensorFlow 1 autoregressive sequence-to-sequence model.
BiDANN — Reimplementation in XJTU-EEG/LibEER MIT (LibEER) We did not find the authors' code. LibEER's version takes differential-entropy features from 62 SEED electrodes split by hemisphere.
HSLT — Reimplementation in XJTU-EEG/LibEER MIT (LibEER) We did not find the authors' code. Works on band-power features grouped by scalp region, with electrode-level and region-level transformers.

Requirements for each port

  • Use the original weights where available and check outputs and gradients against the original code on CPU before merging.
  • Record the preprocessing each model expects: sampling rate, filters, normalization, units, and channel order or electrode positions.
  • Where the source license is restrictive or missing, settle it before copying code or redistributing weights.

Question for the authors

Would you be okay with us integrating your model into Braindecode (over 1M downloads)? :) No action is needed if yes; if not, please let us know before we start implementing it here.

Activity

  1. added
    enhancement
    on Oct 2, 2026
  2. lindicaphxag-tech commented on Oct 3, 2026

    @lindicaphxag-tech
    Contributor

    LEAD checkpoint/source revision audit: the released public P-Base checkpoint now on Hugging Face matches the 2026-09-26 camera-ready source, DL4mHealth/LEAD@834753f209ba7338519c3bb4449a133975cc379b.

    I pinned the HF repository at YiheWang/LEAD@2b1b015dd89133f7c0ca5704ba8ff22039361926 and the single released P-Base file
    checkpoints/LEAD/pretrain/LEAD/P-11-b1024-p50-g16-learnable-3D/nh8_el12_dm128_df256_seed41/checkpoint.pth
    (SHA256 3232e93b5a67a7f3141b16b5ae70b09ae94e65163ccff79755119fbfa598c8db).

    The checkpoint is a pure 367-tensor state dict. Reconstructing the official P-Base configuration from the camera-ready P-Base.sh (12 layers, 8 heads, d_model=128, d_ff=256, patch/stride=50, learnable temporal position, 3D channel position, sampling embeddings 200/100/50) gives:

    • complete model state: 371 tensors;
    • task-specific projection head: 4 tensors;
    • transferable backbone: 367 tensors;
    • released checkpoint: 367 tensors;
    • missing backbone keys: 0;
    • unexpected checkpoint keys: 0;
    • shape mismatches: 0;
    • strict load of the reconstructed camera-ready model state succeeds.

    The schema also provides a useful revision discriminator: the released checkpoint contains enc_embedding.sr_embeddings.hz_{200,100,50} plus the current temporal/spatial attention + fuse_proj layout, which is specific to the camera-ready code path; the earlier revisions do not expose that same embedding contract.

    Independent evidence runs:

    This resolves the source/checkpoint revision question in #1201. I have not started a LEAD port: the source/checkpoint are CC BY-NC-SA 4.0, so I would first want maintainer guidance on whether/how that licensing fits Braindecode's distribution policy.

  3. lindicaphxag-tech commented on Oct 3, 2026

    @lindicaphxag-tech
    Contributor

    LEAD checkpoint provenance update: I traced the newly published P-Base checkpoint against the upstream source history.

    • Hugging Face repo: YiheWang/LEAD@2b1b015dd89133f7c0ca5704ba8ff22039361926
    • only checkpoint candidate: checkpoints/LEAD/pretrain/LEAD/P-11-b1024-p50-g16-learnable-3D/nh8_el12_dm128_df256_seed41/checkpoint.pth
    • checkpoint SHA256: 3232e93b5a67a7f3141b16b5ae70b09ae94e65163ccff79755119fbfa598c8db
    • upstream model source changed at three relevant revisions: initial (2025-02-09), 2026-02-05, and camera-ready 834753f209ba7338519c3bb4449a133975cc379b (2026-09-26).
    • the released checkpoint is a pure 367-tensor state dict. Its schema includes enc_embedding.pos_embedding [1,1024,128], value_embedding [128,50], sampling-rate embeddings for 200/100/50 Hz, 12 encoder layers with the current temporal/spatial attention + fuse projection structure, and final encoder norm.
    • those sampling-rate parameters and the current dataset-aware embedding contract occur in the 2026-09-26 camera-ready source, not the earlier revisions.
    • using the official P-Base configuration (12 layers, 8 heads, d_model=128, d_ff=256, patch/stride=50, learnable temporal position, 3D channel position, sampling embeddings 200/100/50), the released 367 tensors match the camera-ready backbone state exactly: 367/367 keys, no unexpected keys, no missing backbone keys, and no shape mismatches.

    The public checkpoint intentionally contains the transferable backbone rather than the task-specific projection/classification head; the upstream fine-tuning loader likewise filters task-specific heads.

    Independent provenance/state-schema/strict-load runs:

    So the released P-Base checkpoint can be pinned to DL4mHealth/LEAD@834753f209ba7338519c3bb4449a133975cc379b for architecture compatibility. I have not opened a port because the source/checkpoint licensing remains CC BY-NC-SA 4.0, which seems like a separate policy question for Braindecode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions