Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# Usage
|
| 5 |
+
|
| 6 |
+
```python
|
| 7 |
+
from braindecode.models import SignalJEPA
|
| 8 |
+
from huggingface_hub import hf_hub_download
|
| 9 |
+
|
| 10 |
+
weights_path = hf_hub_download(repo_id='braindecode/SignalJEPA', filename='signal-jepa_16s-60_adeuwv4s.pth')
|
| 11 |
+
model_state_dict = torch.load(weights_path)
|
| 12 |
+
|
| 13 |
+
# Signal-related arguments
|
| 14 |
+
# raw: mne.io.BaseRaw
|
| 15 |
+
chs_info = raw.info["chs"]
|
| 16 |
+
sfreq = raw.info['sfreq']
|
| 17 |
+
|
| 18 |
+
model = SignalJEPA(
|
| 19 |
+
sfreq=sfreq,
|
| 20 |
+
input_window_seconds=2,
|
| 21 |
+
chs_info=chs_info,
|
| 22 |
+
n_outputs=1,
|
| 23 |
+
)
|
| 24 |
+
missing_keys, unexpected_keys = model.load_state_dict(model_state_dict, strict=False)
|
| 25 |
+
assert unexpected_keys == []
|
| 26 |
+
# The spatial positional encoder is initialized using the `chs_info`:
|
| 27 |
+
assert set(missing_keys) == {"pos_encoder.pos_encoder_spat.weight"}
|
| 28 |
+
|
| 29 |
+
```
|