File size: 1,959 Bytes
1bd2ac7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
library_name: pytorch
tags:
- eeg
- braindecode
- pytorch
- keras-conversion
- eegsym
license: other
---

# 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

```python
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.