Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🧪 BIO-Distiller: Boosting Supervised Baselines by Distilling Biological Foundation Models

BIO-Distiller is a framework for tuning and distilling supervised learning baselines on RNA sequence based tasks by leveraging knowledge distillation from large biological foundation models (FMs). This repository provides scripts, utilities, and benchmarks for distillation workflows and downstream evaluation.

Library Setup

  1. Install the requirements in requirements.txt.
    pip install -r requirements.txt

Download Datasets

Download the BEACON RNA benchmark dataset and select from the following sequence classification tasks:

  • ncRNA
  • MRL
  • APA
  • PRS ON
  • PRS OFF
  • PRS ON-OFF

Project Structure

  • biod - Scripts for training simple CNNs and their distilled variants
  • fms - Code for fine-tuning biological foundation models

Raytune hyperparamater tuning for the baselines and distilled models

Library setup

Install the package with pip install -e ..

Set envirorment variables

Create a .env file with the following variables included:

DATASETS_DIR="/path/to/datasets/"
TUNE_STORAGE_PATH="/path/to/ray/output/dir"

# Optional
WANDB_API_KEY="your_wandb_api_key"
WANDB_DIR="/path/to/local/wandb/output/dir"

Run experiments

A job can be runned with the command below, where model refers to a simple CNN models with file in config/model, and task refer to a task in config/task.

The following command runs the simple baselines for the specified task

python runner.py model=gbench_cnn task={task}

To distill using feature KD losses, run the following command specifying the task, agg (loss aggregation method: sum or convex), kd_loss (fitnet or eucosine), ft (finetuning of FMs: true or false), and fm (list of FMs to distill from)

python runner.py model=gbench_cnn task={task} +distill={agg} distill.kd_loss_name={kd_loss} distill.fm_is_ft={ft} distill.fm_name=[{fm}]

For response based KD, run the following command

python runner.py model=gbench_cnn task={task} +distill=${agg} distill.kd_loss_name=${kd_loss} distill.fm_is_ft=${ft} distill.fm_name=[{fm}] distill.kd_type=logits

🧬 Finetuning Biological Foundation Models

The fms/ directory contains scripts and utilities for fine-tuning and generating predictions for biological foundation models (FMs) used in the BIO-Distiller pipeline.

Run experiments

To finetune the foundation models, enter the respective [rna/dna/protein] directory and run the following command

python finetune.py --fm {fm_name} --task {task_name}

Once the model is trained, you can obtain the predictions [hidden representations + logits] from either the finetuned or non-finetuned variants by running the following command

python preds.py --fm {fm_name} --task {task_name} --finetuned {true/false} --ds_set {train/test/val}

Available FMs

  • List of available FMs: [RNA: RNA-FM, RNA-MSM, UTRLM-TE+EL, UTRLM-MRL] [DNA: HyenaDNA-tiny1k] [Protein: ESM2 t6-8m]

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages