Autolfads-tf2 - A TensorFlow 2.0 implementation of Latent Factor Analysis via Dynamical Systems (LFADS) and AutoLFADS

Overview

autolfads-tf2

A TensorFlow 2.0 implementation of LFADS and AutoLFADS.

Installation

Clone the autolfads-tf2 repo and create and activate a conda environment with Python 3.7. Use conda to install cudatoolkit and cudnn and pip install the lfads_tf2 and tune_tf2 packages with the -e (editable) flag. This will allow you to import these packages anywhere when your environment is activated, while also allowing you to edit the code directly in the repo.

git clone [email protected]:snel-repo/autolfads-tf2.git
cd autolfads-tf2
conda create --name autolfads-tf2 python=3.7
conda activate autolfads-tf2
conda install -c conda-forge cudatoolkit=10.0
conda install -c conda-forge cudnn=7.6
pip install -e lfads-tf2
pip install -e tune-tf2

Usage

Training single models with lfads_tf2

The first step to training an LFADS model is setting the hyperparameter (HP) values. All HPs, their descriptions, and their default values are given in the defaults.py module. Note that these default values are unlikely to work well on your dataset. To overwrite any or all default values, the user must define new values in a YAML file (example in configs/lorenz.yaml).

The lfads_tf2.models.LFADS constructor takes as input the path to the configuration file that overwrites default HP values. The path to the modeled dataset is also specified in the config, so LFADS will load the dataset automatically.

The train function will execute the training loop until the validation loss converges or some other stopping criteria is reached. During training, the model will save various outputs in the folder specified by MODEL_DIR. Console outputs will be saved to train.log, metrics will be saved to train_data.csv, and checkpoints will be saved in lfads_ckpts.

After training, the sample_and_average function can be used to compute firing rate estimates and other intermediate model outputs and save them to posterior_samples.h5 in the MODEL_DIR.

We provide a simple example in example_scripts/train_lfads.py.

Training AutoLFADS models with tune_tf2

The autolfads-tf2 framework uses ray.tune to distribute models over a computing cluster, monitor model performance, and exploit high-performing models and their HPs.

Setting up a ray cluster

If you'll be running AutoLFADS on a single machine, you can skip this section. If you'll be running across multiple machines, you must initialize the cluster using these instructions before you can submit jobs via the Python API.

Fill in the fields indicated by <>'s in the ray_cluster_template.yaml, and save this file somewhere accessible. Ensure that a range of ports is open for communication on all machines that you intend to use (e.g. 10000-10099 in the template). In your autolfads-tf2 environment, start the cluster using ray up <NEW_CLUSTER_CONFIG>. The cluster may take up to a minute to get started. You can test that all machines are in the cluster by ensuring that all IP addresses are printed when running example_scripts/ray_test.py.

Starting an AutoLFADS run

To run AutoLFADS, copy the run_pbt.py script and adjust paths and hyperparameters to your needs. Make sure to only use only as many workers as can fit on the machine(s) at once. If you want to run across multiple machines, make sure to set SINGLE_MACHINE = False in run_pbt.py. To start your PBT run, simply run run_pbt.py. When the run is complete, the best model will be copied to a best_model folder in your PBT run folder. The model will automatically be sampled and averaged and all outputs will be saved to posterior_samples.h5.

References

Keshtkaran MR, Sedler AR, Chowdhury RH, Tandon R, Basrai D, Nguyen SL, Sohn H, Jazayeri M, Miller LE, Pandarinath C. A large-scale neural network training framework for generalized estimation of single-trial population dynamics. bioRxiv. 2021 Jan 1.

Keshtkaran MR, Pandarinath C. Enabling hyperparameter optimization in sequential autoencoders for spiking neural data. Advances in Neural Information Processing Systems. 2019; 32.

Comments
  • Update lfads-tf2 dependencies for Google Colab compatibility

    Update lfads-tf2 dependencies for Google Colab compatibility

    Summary of changes to setup.py

    • Change pandas==1.0.0 to pandas==1.* to avoid a dependency conflict with google-colab
    • Add PyYAML>=5.1 so that yaml.full_loadworks in lfads-tf2.
    opened by yahiaali 0
  • Are more recent versions of tensorflow/CUDA supported by the package?

    Are more recent versions of tensorflow/CUDA supported by the package?

    Right now the package supports TF 2.0 and CUDA 10.0 which are more than 3 years old. Is there support planned/already established for more recent Tensorflow and CUDA versions?

    Thanks!

    opened by stes 0
  • Error: No 'git' repo detected for 'lfads_tf2'

    Error: No 'git' repo detected for 'lfads_tf2'

    Hello, I am having this issue. I have followed all the installation instructions, and I was wondering why this issue would come up. autolfads-tf2 is cloned using git, and it is inside the git folder. But it seems like train_lfads.py is not loading data. I am using Window 10.

    error

    Thank you so much in advance!

    opened by jinoh5 0
  • Add warnings and assertion to chop functions for bad overlap

    Add warnings and assertion to chop functions for bad overlap

    Add warnings and assertion to chop functions when requested overlap is greater than half of window length

    Addresses https://github.com/snel-repo/autolfads-tf2/issues/2

    opened by raeedcho 0
  •  `merge_chops` is unable to merge when the requested overlap is more than half of the window length

    `merge_chops` is unable to merge when the requested overlap is more than half of the window length

    Without really thinking a whole lot about it, I chopped data to window length 100 and overlap 80, since this would leave at most 20 points of unmodeled data at the end of the trials I'm trying to model. The chopping seems to work totally fine, but when merging the chops together, it seems that the code assumes that the overlap will be at most half the size of the window, and the math to put the chops back together breaks down in weird ways, leading to duplicated data in the final array.

    On further thought, it makes sense to some degree to limit the overlap to be at most half of the window length, since otherwise, data from more than two chops would have to be integrated together to merge everything--if this is the thought process, I think it would be a good idea to put an assertion in both functions that this is the case (or maybe at least an assertion in the merge_chops function and a warning in the chop_data function, since chopping technically works fine).

    If instead it would make sense to be able to merge chops with overlap greater than half the window size, then I think the merge_chops function needs to be reworked to be able to integrate across more than two chops

    opened by raeedcho 0
Releases(v0.1)
Owner
Systems Neural Engineering Lab
Emory University and Georgia Institute of Technology
Systems Neural Engineering Lab
(IEEE TIP 2021) Regularized Densely-connected Pyramid Network for Salient Instance Segmentation

RDPNet IEEE TIP 2021: Regularized Densely-connected Pyramid Network for Salient Instance Segmentation PyTorch training and testing code are available.

Yu-Huan Wu 41 Oct 21, 2022
Underwater industrial application yolov5m6

This project wins the intelligent algorithm contest finalist award and stands out from over 2000teams in China Underwater Robot Professional Contest, entering the final of China Underwater Robot Prof

8 Nov 09, 2022
The dynamics of representation learning in shallow, non-linear autoencoders

The dynamics of representation learning in shallow, non-linear autoencoders The package is written in python and uses the pytorch implementation to ML

Maria Refinetti 4 Jun 08, 2022
FAST-RIR: FAST NEURAL DIFFUSE ROOM IMPULSE RESPONSE GENERATOR

This is the official implementation of our neural-network-based fast diffuse room impulse response generator (FAST-RIR) for generating room impulse responses (RIRs) for a given acoustic environment.

Anton Jeran Ratnarajah 89 Dec 22, 2022
Codes and models for the paper "Learning Unknown from Correlations: Graph Neural Network for Inter-novel-protein Interaction Prediction".

GNN_PPI Codes and models for the paper "Learning Unknown from Correlations: Graph Neural Network for Inter-novel-protein Interaction Prediction". Lear

Ursa Zrimsek 2 Dec 14, 2022
Pseudo-Visual Speech Denoising

Pseudo-Visual Speech Denoising This code is for our paper titled: Visual Speech Enhancement Without A Real Visual Stream published at WACV 2021. Autho

Sindhu 94 Oct 22, 2022
Dataloader tools for language modelling

Installation: pip install lm_dataloader Design Philosophy A library to unify lm dataloading at large scale Simple interface, any tokenizer can be inte

5 Mar 25, 2022
NPBG++: Accelerating Neural Point-Based Graphics

[CVPR 2022] NPBG++: Accelerating Neural Point-Based Graphics Project Page | Paper This repository contains the official Python implementation of the p

Ruslan Rakhimov 57 Dec 03, 2022
Seeing if I can put together an interactive version of 3b1b's Manim in Streamlit

streamlit-manim Seeing if I can put together an interactive version of 3b1b's Manim in Streamlit Installation I had to install pango with sudo apt-get

Adrien Treuille 6 Aug 03, 2022
Code for CVPR2021 "Visualizing Adapted Knowledge in Domain Transfer". Visualization for domain adaptation. #explainable-ai

Visualizing Adapted Knowledge in Domain Transfer @inproceedings{hou2021visualizing, title={Visualizing Adapted Knowledge in Domain Transfer}, auth

Yunzhong Hou 80 Dec 25, 2022
a grammar based feedback fuzzer

Nautilus NOTE: THIS IS AN OUTDATE REPOSITORY, THE CURRENT RELEASE IS AVAILABLE HERE. THIS REPO ONLY SERVES AS A REFERENCE FOR THE PAPER Nautilus is a

Chair for Sys­tems Se­cu­ri­ty 158 Dec 28, 2022
Code for NAACL 2021 full paper "Efficient Attentions for Long Document Summarization"

LongDocSum Code for NAACL 2021 paper "Efficient Attentions for Long Document Summarization" This repository contains data and models needed to reprodu

56 Jan 02, 2023
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries

Thinc: A refreshing functional take on deep learning, compatible with your favorite libraries From the makers of spaCy, Prodigy and FastAPI Thinc is a

Explosion 2.6k Dec 30, 2022
Efficient face emotion recognition in photos and videos

This repository contains code of face emotion recognition that was developed in the RSF (Russian Science Foundation) project no. 20-71-10010 (Efficien

Andrey Savchenko 239 Jan 04, 2023
LibMTL: A PyTorch Library for Multi-Task Learning

LibMTL LibMTL is an open-source library built on PyTorch for Multi-Task Learning (MTL). See the latest documentation for detailed introductions and AP

765 Jan 06, 2023
A Kernel fuzzer focusing on race bugs

Razzer: Finding kernel race bugs through fuzzing Environment setup $ source scripts/envsetup.sh scripts/envsetup.sh sets up necessary environment var

Systems and Software Security Lab at Seoul National University (SNU) 328 Dec 26, 2022
Code for ICCV2021 paper SPEC: Seeing People in the Wild with an Estimated Camera

SPEC: Seeing People in the Wild with an Estimated Camera [ICCV 2021] SPEC: Seeing People in the Wild with an Estimated Camera, Muhammed Kocabas, Chun-

Muhammed Kocabas 187 Dec 26, 2022
[CVPR'21] FedDG: Federated Domain Generalization on Medical Image Segmentation via Episodic Learning in Continuous Frequency Space

FedDG: Federated Domain Generalization on Medical Image Segmentation via Episodic Learning in Continuous Frequency Space by Quande Liu, Cheng Chen, Ji

Quande Liu 178 Jan 06, 2023
Patch SVDD for Image anomaly detection

Patch SVDD Patch SVDD for Image anomaly detection. Paper: https://arxiv.org/abs/2006.16067 (published in ACCV 2020). Original Code : https://github.co

Hong-Jeongmin 0 Dec 03, 2021
Codes for the AAAI'22 paper "TransZero: Attribute-guided Transformer for Zero-Shot Learning"

TransZero [arXiv] This repository contains the testing code for the paper "TransZero: Attribute-guided Transformer for Zero-Shot Learning" accepted to

Shiming Chen 52 Jan 01, 2023