This repository contains code, data and model weights.
The overall model architecture is shown below:
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 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
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=sharingTo 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.gzTrain InstructPro-1B model:
bash train_1B_model_parallel.shTrain InstructPro-3B model:
bash train_3B_model_parallel.shbash generate_instructpro_1b_seen.shThere are two items in the output directory:
- design.txt refers to the designed protein sequence
- 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.shIf 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