nas / PFMBench /readme.md
yuccaaa's picture
Add files using upload-large-folder tool
9627ce0 verified

PFMBench

License

PFMBench: A comprehensive Protein Foundation Model Benchmark suite.


πŸ” Overview

PFMBench is a unified benchmark suite for evaluating Protein Foundation Models (PFMs) across dozens of downstream tasks. It supports both fine-tuning on labeled data and zero-shot evaluation, and is built on top of Hydra + PyTorch Lightning for maximum flexibility and reproducibility.


🌟 Features

  • 38 downstream tasks covering structure, function, localization, mutagenesis, interaction, solubility, production, and zero-shot settings.
  • 17 pre-trained models spanning sequence-only, structure-augmented, function-aware, and multimodal PFMs.
  • PEFT support: Adapter, LoRA, AdaLoRA, DoRA, IA3, etc.
  • Zero-shot recipes: MSA-based, protein language model, ProteinGym protocols.
  • Modular design: Easily swap datasets, models, tuning methods, and evaluation metrics.
  • Logging & visualization via Weights & Biases; built-in plotting in output_model_plots/.

πŸ“¦ Installation

# Clone the repo
git clone https://github.com/biomap-research/PFMBench.git
cd PFMBench

# Install Python dependencies
conda env create -f environment.yml

# Or you can use our Docker image via: docker pull whwendell/pfmbench:latest

πŸ—‚οΈ Project Structure

PFMBench/
β”œβ”€β”€ output_model_plots/      # Generated plots (scTM, diversity, etc.)
β”œβ”€β”€ src/                     # Core library
β”‚   β”œβ”€β”€ data/                # dataset loaders & preprocessors
β”‚   β”œβ”€β”€ interface/           # generic task & model interface classes
β”‚   β”œβ”€β”€ model/               # model wrappers & PEFT adapters
β”‚   β”œβ”€β”€ utils/               # common utilities (metrics, logging, etc.)
β”‚   └── __init__.py
β”œβ”€β”€ tasks/                   # Fine-tuning experiments
β”‚   β”œβ”€β”€ configs/             # Hydra config files
β”‚   β”œβ”€β”€ results/             # Checkpoints & logs
β”‚   β”œβ”€β”€ data_interface.py    # task-specific data loader
β”‚   β”œβ”€β”€ model_interface.py   # task-specific model wrapper
β”‚   β”œβ”€β”€ main.py              # entrypoint for training/eval
β”‚   β”œβ”€β”€ tuner.py             # hyperparameter-search helper
β”‚   └── __init__.py
β”œβ”€β”€ wandb/                   # Weights & Biases scratch dir
β”œβ”€β”€ zeroshot/                # Zero-shot pipelines
β”‚   β”œβ”€β”€ msa/                 # MSA-based scoring
β”‚   β”œβ”€β”€ pglm/                # protein-LM zero-shot
β”‚   β”œβ”€β”€ saprot/              # ProteinGym protocol
β”‚   β”œβ”€β”€ data_interface.py    # generic zero-shot data loader
β”‚   β”œβ”€β”€ model_interface.py   # generic zero-shot model wrapper
β”‚   β”œβ”€β”€ msa_kl_light.py      # light MSA KL-div zero-shot
β”‚   β”œβ”€β”€ msa_kl_light copy.py # (backupβ€”can remove)
β”‚   └── proteingym_light.py  # light ProteinGym zero-shot
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
β”œβ”€β”€ environment.yml
└── README.md

πŸš€ Quick Start

Fine-tuning a single task

# Example: run fine-tuning with specific GPU and configs
env CUDA_VISIBLE_DEVICES=0 \
    python tasks/main.py \
    --config_name binding_db \
    --pretrain_model_name esm2_35m \
    --offline 0

Zero-shot evaluation

# Example: run zero-shot MSA KL-div scoring
env CUDA_VISIBLE_DEVICES=0 \
    python zeroshot/msa_kl_light.py \
    --config_name zero_msa_kl \
    --pretrain_model_name esm2_35m \
    --offline 0

Replace --config_name, --pretrain_model_name, and --offline flags as needed.


πŸ–ΌοΈ Architecture Diagram

PFMBench Framework


πŸ“– Citation

If you use PFMBench in your work, please cite:

@article{gao2025pfmbench,
  title={PFMBench: Protein Foundation Model Benchmark},
  author={Gao, Zhangyang and Wang, Hao and Tan, Cheng and Xu, Chenrui and Liu, Mengdi and Hu, Bozhen and Chao, Linlin and Zhang, Xiaoming and Li, Stan Z},
  journal={arXiv preprint arXiv:2506.14796},
  year={2025}
}

πŸ“ License

This project is licensed under the Apache License 2.0.