Skip to content

Repository files navigation

InstructPro: Natural Language Guided Ligand-Binding Protein Design

Model Architecture

This repository contains code, data and model weights.

The overall model architecture is shown below:

image

Environment

The dependencies can be set up using the following commands:
conda create -n instructpro python=3.9.23 
conda activate instructpro
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
pip install transformers==4.49.0
bash setup.sh 

Download Data

We provide the training and evaluation data at InstructPro_Data

Please download the dataset and put them in the data folder:

mkdir data 
cd data 
wget https://drive.google.com/file/d/1u5L8gJ1WEMzPg0b4NpzSWUsxYoXmZyK4/view?usp=sharing

Download Model

We provide the InstructPro-1B and InstructPro-3B model weights used in the paper at InstructPro-1B and InstructPro-3B

Please download the checkpoints and put them in the models folder:

mkdir models
mkdir models/InstructPro_1B
mkdir models/InstructPro_3B
cd models/InstructPro_1B
wget https://drive.google.com/file/d/1n4fJUO_-DcAeMOY_b6wmbwOAF037OG4r/view?usp=sharing
cd models/InstructPro_3B
wget https://drive.google.com/file/d/1XQSsuRxJxFNOvcqMDubkG-R8SEkl88Td/view?usp=sharing

To train and evaluate our InstructPro, you'll additionally need the pretrained ProGen2 model weights:

mkdir models
mkdir models/progen2-base
mkdir models/progen2-BFD90
cd models/progen2-base
wget https://storage.googleapis.com/sfr-progen-research/checkpoints/progen2-base.tar.gz
tar -xvzf progen2-base.tar.gz
cd models/progen2-BFD90
wget https://storage.googleapis.com/sfr-progen-research/checkpoints/progen2-BFD90.tar.gz
tar -xvzf progen2-BFD90.tar.gz

Training

If you want to train your own model, please follow the training guidance below. Otherwise, you can directly go to the Inference section.

Train InstructPro-1B model:

bash train_1B_model_parallel.sh

Train InstructPro-3B model:

bash train_3B_model_parallel.sh

Inference

To design ligand-binding proteins following the human instructions using InstructPro-1b model on the seen ligands, please use the following scripts:
bash generate_instructpro_1b_seen.sh

There are two items in the output directory:

  1. design.txt refers to the designed protein sequence
  2. target.txt refers to the ground truth protein sequences

To design the proteins on the unseen ligand split:

mkdir data/instructpro_data/unseen
cp data/instructpro_data/test.unseen.jsonl data/instructpro_data/unseen/test.dataset_tokenized.jsonl
bash generate_instructpro_1b_unseen.sh

Designing Your Own Protein

If you want to design proteins following your own instructions, follow the pipeline below:

First, you'll need to prepare your own data (don't forget to add special tokens and ):

cd example
python prepare_example_data.py --instruction "Generate a protein designed to fulfill the particular function <FUNCTION> Catalyzes the formation of the signaling molecule cAMP in response to G-protein signaling. </FUNCTION>" --ligand_smiles "Nc1ncnc2n(cnc12)[C@@H]1O[C@H](COP([O-])(=O)OP([O-])(=O)OP([O-])([O-])=O)[C@@H](O)[C@H]1O"
cd ..

Then run the generation code as follows:

bash generate_instructpro_1b_example.sh

About

natural language guided ligand-binding protein design model

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages