EEGSym original Keras 8-channel weights converted to PyTorch

This repository contains a PyTorch state_dict converted from the original Keras EEGSym_pretrained_weights_8_electrode.h5 checkpoint for the 8-electrode EEGSym configuration.

The checkpoint targets the faithful PyTorch port in:

replicability.eegsym_faithful.FaithfulEEGSym

It is not a drop-in checkpoint for the current upstream braindecode.models.EEGSym topology. The upstream model is structurally close, but it differs from the authors' released Keras architecture in enough places that the original weights cannot be loaded 1:1 without an architecture-compatibility path.

Expected Input

  • Shape: (batch, 8, 384)
  • Sampling rate: 128 Hz
  • Canonical channel order: F3, C3, P3, Cz, Pz, F4, C4, P4
  • Output: 2 logits

Verification

  • Keras H5 SHA256: f60ddd220cf48dd18dd9706c5389c70a244fe878610021c2ed97d40105145b2b
  • State values excluding num_batches_tracked: 144440
  • Trainable parameters: 142784
  • H5 datasets consumed: 146/146
  • PyTorch tensors filled: 146/146
  • Forward probe output shape: (2, 2)
  • Source replicability commit: a76ee9bf66204b4ebd07746aeb48933dd4272daa

Loading

import torch
from replicability.eegsym_faithful import FaithfulEEGSym

model = FaithfulEEGSym(n_chans=8, n_outputs=2, n_times=384)
state_dict = torch.load("pytorch_model.bin", map_location="cpu")
model.load_state_dict(state_dict)
model.eval()

Provenance

The original Keras checkpoint was obtained from the authors' EEGSym reference code mirrored under the replicability evidence tree:

research/evidence/source_code_repos/EEGSym/EEGSym/EEGSym_pretrained_weights_8_electrode.h5

This conversion only changes tensor layout from Keras/HDF5 conventions to the faithful PyTorch module layout; it does not retrain or modify the learned values.

Training data

The data that shaped these weights. The ids are the datasets: field of this card, which braindecode reads into model.card_data.datasets when you call from_pretrained (MOABB class names for MOABB datasets, OpenNeuro / NEMAR accessions, Hub ids otherwise). nm/on ids are datasets on NEMAR (on = NEMAR's copy of the OpenNeuro dataset with the same number). Rows marked private: are data the authors did not release; they are not in datasets:.

Cite Braindecode

If you use this braindecode port in scientific work, cite the software on Zenodo, doi:10.5281/zenodo.17699192, and the original model and datasets cited above.

@software{braindecode,
  author = {Aristimunha, Bruno and
            Guetschel, Pierre and
            Wimpff, Martin and
            Gemein, Lukas and
            Rommel, Cedric and
            Banville, Hubert and
            Sliwowski, Maciej and
            Wilson, Daniel and
            Brandt, Simon and
            Gnassounou, Théo and
            Paillard, Joseph and
            {Junqueira Lopes}, Bruna and
            Sedlar, Sara and
            Moreau, Thomas and
            Chevallier, Sylvain and
            Gramfort, Alexandre and
            Schirrmeister, Robin Tibor},
  title = {Braindecode: toolbox for decoding raw electrophysiological brain data
           with deep learning models},
  url = {https://github.com/braindecode/braindecode},
  doi = {10.5281/zenodo.17699192},
  publisher = {Zenodo},
  license = {BSD-3-Clause},
}
Downloads last month
65
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support