Giter Club home page Giter Club logo

boldgpt's Introduction

boldGPT ๐Ÿง 

boldGPT

Humans struggle to "see" the structure in functional MRI (BOLD) brain maps. Our goal is to train a GPT that understands brain maps better than humans. This kind of "foundation" model should be useful for things like phenotype prediction and brain activity decoding. Plus it will hopefully generate neat fake brain maps.

Roadmap

  • Prepare the natural scenes dataset for GPT consumption
    • NSD "beta" activity vectors to flat maps (NSD-Flat, ๐Ÿค—)
    • Flat maps to tokenized patch sequences (BoldTokenizer) supporting raster, radial, and random order.
  • Implement model
    • BoldGPT supporting causal/cross attention, masking, and shuffled prediction. Borrows elements from timm, nanoGPT, and BEiT.
  • Implement training script
    • train_gpt.py for training models on shuffled next patch prediction.
  • Train models
    • Initial training run with ViT-small, shuffled next patch prediction with discrete token targets, 1000 epochs.
  • Implement benchmarks
  • Evaluation
  • Generate pretty brain maps

Results

Initial training run

Train examples

In our first training run, we trained a ViT-small decoder to auto-regressively predict the next patch (like GPT). However, the patch order is shuffled for each training example. So it's actually a bit like training a masked prediction (BERT/MAE) style model on all possible masking ratios simultaneously. The targets are discrete patch tokens from k-means (like HUBERT). We trained the model on NSD-Flat for 1000 epochs (90K steps) with a batch size of 2048 on 4 V100 GPUs. The figure shows the patch order, activity data, target tokens, and predictions for a few training samples at the end of training.

Installation

Clone the repo and install the package in a new virtual environment

git clone https://github.com/clane9/boldGPT.git
cd boldGPT

python3 -m venv --prompt boldgpt .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
pip install -e .

Contribute

If you'd like to contribute, please feel free fork the repo and join (or start!) a conversation in our issues.

Citation

If you find this repository helpful, please consider citing:

@article{lane2023boldgpt,
  author       = {Connor Lane},
  title        = {boldGPT: A GPT foundation model for brain activity maps},
  howpublished = {\url{https://github.com/clane9/boldGPT}},
  year         = {2023},
}

boldgpt's People

Contributors

clane9 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.