Skip to content

Latest commit

 

History

108 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OHBA Software Library: Foundation Model Toolbox

This repository contains a TensorFlow-based tokeniser and foundation model (MEG-GPT) for parcellated MEG data. Note, a PyTorch version of the tokeniser and foundation model is currently under development:

Paper: MEG-GPT: A transformer-based foundation model for magnetoencephalography data.

Installation

We recommend using mamba to install osl-foundation, which can be installed with:

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
rm Miniforge3-$(uname)-$(uname -m).sh

Then osl-foundation can be installed with:

git clone https://github.com/OHBA-analysis/osl-foundation.git
cd osl-foundation
mamba env create -f envs/oslf.yml
conda activate oslf
pip install -e .

Note, MEG-GPT requires TensorFlow 2.11 and comes with osl-dynamics.

BMRC Cluster (Oxford)

conda/mamba are available as a software module:

module load Miniforge3

osl-foundation can be installed with:

git clone https://github.com/OHBA-analysis/osl-foundation.git
cd osl-foundation
mamba env create -f envs/bmrc.yml
conda activate oslf
pip install -e .

Note, the following CUDA module needs to be loaded on BMRC to use TensorFlow:

module load cuDNN/8.4.1.50-CUDA-11.7.0

Usage

See the examples directory.

Load the pre-trained models

Tokenizer:

from osl_foundation import load_model

tokenizer = load_model("/path/to/osl-foundation/models/tokenizer")

MEG-GPT model:

from osl_foundation import load_model

meg_gpt = load_model("/path/to/osl-foundation/models/meg-gpt", checkpoint="latest")

About

TensorFlow foundation models for MEG analysis.

Resources

Stars

4 stars

Watchers

5 watching

Forks

Contributors

Languages