{"id":18850898,"url":"https://github.com/igitugraz/se-adlif","last_synced_at":"2025-04-14T09:51:07.864Z","repository":{"id":251395347,"uuid":"836784548","full_name":"IGITUGraz/SE-adlif","owner":"IGITUGraz","description":"Code for \"Advancing Spatio-Temporal Processing in Spiking Neural Networks through Adaptation\"","archived":false,"fork":false,"pushed_at":"2025-02-12T11:37:51.000Z","size":96046,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T23:06:57.091Z","etag":null,"topics":["neuromorphic-computing","neuroscience","oscillations","spiking-neural-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IGITUGraz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-01T14:50:09.000Z","updated_at":"2025-02-12T12:01:43.000Z","dependencies_parsed_at":"2024-08-02T18:10:20.505Z","dependency_job_id":"4e97b289-aab0-49bc-bdea-c619b0bb7a38","html_url":"https://github.com/IGITUGraz/SE-adlif","commit_stats":null,"previous_names":["igitugraz/se-adlif"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FSE-adlif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FSE-adlif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FSE-adlif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FSE-adlif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IGITUGraz","download_url":"https://codeload.github.com/IGITUGraz/SE-adlif/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248859618,"owners_count":21173337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neuromorphic-computing","neuroscience","oscillations","spiking-neural-networks"],"created_at":"2024-11-08T03:32:26.647Z","updated_at":"2025-04-14T09:51:07.854Z","avatar_url":"https://github.com/IGITUGraz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SE-adLIF\r\n\r\n[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]\r\n\r\n## Baronig, Ferrand, Sabathiel \u0026 Legenstein (2024):\r\n**Advancing Spatio-Temporal Processing in Spiking Neural Networks through Adaptation**\r\n\r\n---\r\n\r\n## 📌 Getting Started\r\n\r\n### Install Dependencies\r\nTo set up the required environment, run:\r\n```sh\r\nconda env create -f environment.yml\r\n```\r\n\r\n---\r\n\r\n## 🔄 Reproducing Results\r\n\r\n### SHD, SCC, ECG, BSD, and Oscillation Experiments\r\nTo start an experiment, use:\r\n```sh\r\npython run.py experiment=\u003cexperiment_name\u003e ++logdir=path/to/my/logdir ++datadir=path/to/my/datadir\r\n```\r\n**Notes:**\r\n- `datadir` is **mandatory** and should contain the datasets.\r\n- For SHD and SSC, data is downloaded automatically if not found at `datadir/SHDWrapper`.\r\n- BSD and oscillation toy task, datasets are created on the fly, so `datadir` can point to an empty directory.\r\n- Results are stored in a local `results` folder unless `resultdir` is specified.\r\n- `\u003cexperiment_name\u003e` refers to configurations in `./config/experiment/`.\r\n\r\n### Configuration Overrides (Hydra)\r\nWe use [Hydra](https://hydra.cc/) for configuration management. To override parameters, use the `++` syntax. For example, to change the number of training epochs:\r\n```sh\r\npython run.py experiment=SHD_SE_adLIF_small ++logdir=path/to/my/logdir ++datadir=path/to/my/datadir ++n_epochs=10\r\n```\r\nFor the BSD task with a different number of classes (Figure 6b):\r\n```sh\r\npython run.py experiment=BSD_SE_adLIF ++logdir=path/to/my/logdir ++datadir=path/to/my/datadir ++dataset.num_classes=10\r\n```\r\n\r\n---\r\n\r\n## 🎵 Audio Compression Experiments\r\nTo start an audio compression experiment, use:\r\n```sh\r\npython run_compress.py experiment=\u003cexperiment_name\u003e ++logdir=path/to/my/logdir ++datadir=path/to/my/datadir\r\n```\r\n### Available Configurations\r\n- **SE-adLIF**: `compress_libri_SE_adLIF`\r\n- **EF-adLIF**: `compress_libri_EF_adLIF`\r\n- **LIF**: `compress_libri_LIF`\r\n\r\n---\r\n\r\n## 📊 Evaluating Audio Compression Models \r\nModel checkpoints for each configuration are available at [checkpoints](https://github.com/IGITUGraz/SE-adlif/tree/main/checkpoints).\r\n\r\n### 1️⃣ Generating Wave Files\r\nTo generate wave files from a checkpoint:\r\n```sh\r\ngenerate_waves.py ckpt_path=/path/to/ckpt/example.ckpt source_wave_path=/path/to/libritts/location/ pred_wave_path=/path/to/prediction/ encoder_only=$encoder_flag\r\n```\r\n- `$encoder_flag`: `true` or `false`.\r\n- `source_wave_path` can be a single `.wav` file or a directory containing `.wav` files.\r\n- If no valid `.wav` files exist, the clean test-set from LibriTTS (~9h of audio) is used.\r\n\r\n### 2️⃣ Evaluating Generated Waves\r\nUse `evaluate_metrics.py` to compute SI-SNR or [Visqol](https://github.com/google/visqol):\r\n```sh\r\nevaluate_metrics.py metric=$metric source_wave_path=path/to/source/waves pred_wave_path=path/to/model/predictions\r\n```\r\n- `$metric` can be `si_snr` or `visqol`.\r\n- **Note:** Visqol must be compiled manually following [these instructions](https://github.com/google/visqol). Additionally, the project requires either `gcc-9`/`g++-9` or `gcc-10`/`g++-10`. Set the compiler using:\r\n```sh\r\nexport CC=gcc-9 CXX=g++-9\r\n```\r\nFurthermore, Visqol relies on Bazel but references an outdated HTTP resource (Armadillo) in its WORKSPACE file. \r\nThe ressource has been moved [here](https://sourceforge.net/projects/arma/files/retired/armadillo-9.900.1.tar.xz.RETIRED/download).\r\nYou should modify the WORKSPACE file to reference your local copy as instructed [here](https://github.com/google/visqol/issues/117#issuecomment-2407779701).\r\n\r\n---\r\n\r\n## ⚠️ Important Information\r\n\r\n### 🔹 Configuring `main.yaml`\r\nGlobal parameters (e.g., `device: 'cpu'`, `cuda:0`) can be set in `config/main.yaml`. These settings are used by PyTorch Lightning’s `SingleDeviceStrategy`.\r\n\r\n### 🔹 Block Index Padding\r\nFor variable-length sequences (e.g., SHD, SSC), a **custom masking procedure** is used:\r\n- **Data vector:** Contains actual data, padded with zeros.\r\n- **Block index (`block_idx`)**: Indicates valid data (1s) and padding (0s).\r\n- **Target vector**: Maps indices to corresponding labels.\r\n\r\n#### Example 1: Single Block Targeting\r\n```\r\ndata vector: |1011010100101001010000000000000|\r\n             |-----data---------|--padding---|\r\n             ---\u003e time\r\n\r\nblock_idx:   |1111111111111111111100000000000|\r\ntarget: [-1, 3]\r\n```\r\n**Explanation:**\r\n- Block `0` has target `-1` (ignored).\r\n- Block `1` has target class `3`.\r\n\r\n#### Example 2: Per-Timestep Labeling (ECG Task)\r\n```\r\ndata vector: |1 0 1 1 0 0 1 0 0 0 0 0 0|\r\n             |-----data---|--padding---|\r\n             ---\u003e time\r\n\r\nblock_idx:   |1 2 3 4 5 6 7 0 0 0 0 0 0|\r\ntarget: [-1, 4, 3, 1, 3, 4, 6, 3]\r\n```\r\n**Explanation:**\r\n- Multiple blocks (`1-7`) have corresponding target labels.\r\n- Padding (`0s`) is ignored during loss computation.\r\n\r\nUsing this method, **per-block predictions** can be efficiently gathered using `torch.scatter_reduce`, ignoring padded time steps.\r\n\r\n---\r\n\r\n\r\n\r\nThis work is licensed under a\r\n[Creative Commons Attribution-ShareAlike 4.0 International License][cc-by-sa].\r\n\r\n[![CC BY-SA 4.0][cc-by-sa-image]][cc-by-sa]\r\n\r\n[cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/\r\n[cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png\r\n[cc-by-sa-shield]: https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figitugraz%2Fse-adlif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figitugraz%2Fse-adlif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figitugraz%2Fse-adlif/lists"}