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.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support