Cross-modal knowledge distillation from multi-session spike models to LFP models to develop LFP models with enhanced representational power.
You can set up a Python 3.9 environment via conda create -n <env_name> python=3.9. Then, after activating your virtual environment, please install the required packages and cross_modal_distillation package through
pip install torch==2.4.0+cu121 --extra-index-url https://download.pytorch.org/whl/cu121pip install -e .
- The data configs are located under
cross_modal_distillation/data/configs(for final datasets used for model training, combines individual dataset configs) andcross_modal_distillation/data/configs/single(for individual datasets). - The default data location is denoted under
base.yaml(undercross_modal_distillation/data/configs/single) config as./results/data. If you prefer a different location, please make sure to change it. - Dataset download operations are automatized for
MakinRTdataset, but not for theFlintCOdataset. For that dataset, please download the raw dataset from https://crcns.org/data-sets/movements/dream/downloading-dream, and place the downloaded.matfiles (e.g.,Flint_2012_e1.mat) under the<root_save_dir>/FlintCO/rawdirectory (note that the defaultroot_save_diris./results/data). - In our experiments, we used 5 second segments which were generated from 10 second segments by chunking. We followed this logic to ensure same train/val/test splits across different segment lenghts, which was a part of our design and experimentation process. These steps can also be found in
inference_generalization.ipynbnotebook.
We provide multiple model checkpoints for reproducing Fig. 5 in Section 4.3:
ms_lfp.ckpt: This is the MS-LFP model pretrained on the LFP signals of 34 recording sessions across 2 subjects. This model included all sessions shown inFig. 5in its pretraining dataset. Also, this is the MS-LFP model whose performance was also shown inFig. 3and other figures, after fine-tuning on the LFP signals of the sessions shown if that session was held-out in the pretraining.distilled_lfp_monkeyI_20160622_01.ckpt: This is the Distilled LFP model trained on the LFP signals ofMonkey I's20160622_01recording session.distilled_lfp_monkeyC_e1_1.ckpt: Same asdistilled_lfp_monkeyI_20160622_01.ckpt, but forMonkey C'se1_1recording session.
Please follow the notebook we provided in inference_generalization.ipynb to reproduce the generalization results shown in Fig. 5 (Section 4.3). Overall, the steps followed in that notebook are:
- Generating 10 second and 5 second LFP datasets.
- Building and loading the MS-LFP checkpoint provided.
- Performing inference and decoding using the loaded MS-LFP model. These results serve as the baseline for evaluating the generalization performance of the Distilled LFP models. Note that while the recording sessions used for generalization were included in the pretraining dataset of the loaded MS-LFP model, these generalization sessions were entirely excluded from the distillation process as well as from the spike teacher model training.
- Building and loading the Distilled LFP models trained on recording sessions
20160622_01ande1_1. - Perform inference and decoding with the loaded Distilled LFP models by passing the LFP signals from the generalization sessions as if they originated from the recording sessions used during distillation.
Please check out our manuscript for full results and further details.
Copyright (c) 2025 University of Southern California
See full notice in LICENSE.md
Eray Erturk, Saba Hashemi, and Maryam M. Shanechi
Shanechi Lab, University of Southern California