Transformers
PyTorch
esm
biology
protein-language-model
protein-generation
protein-structure
diffusion
Instructions to use airkingbd/dplm2_650m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use airkingbd/dplm2_650m with Transformers:
# Load model directly from transformers import AutoTokenizer, EsmForDPLM2 tokenizer = AutoTokenizer.from_pretrained("airkingbd/dplm2_650m") model = EsmForDPLM2.from_pretrained("airkingbd/dplm2_650m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- biology
|
| 6 |
+
- protein-language-model
|
| 7 |
+
- protein-generation
|
| 8 |
+
- protein-structure
|
| 9 |
+
- diffusion
|
| 10 |
+
- esm
|
| 11 |
+
- pytorch
|
| 12 |
+
- arxiv:2410.13782
|
| 13 |
+
- arxiv:2504.11454
|
| 14 |
+
datasets:
|
| 15 |
+
- airkingbd/pdb_swissprot
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# DPLM-2 650M
|
| 19 |
+
|
| 20 |
+
DPLM-2 is a multimodal diffusion protein language model for jointly modeling,
|
| 21 |
+
understanding, and generating protein sequences and structures. It extends the
|
| 22 |
+
discrete diffusion protein language model family from sequence-only protein
|
| 23 |
+
language modeling to sequence-structure modeling, enabling protein
|
| 24 |
+
sequence-structure co-generation and conditional generation tasks such as
|
| 25 |
+
folding, inverse folding, and motif scaffolding.
|
| 26 |
+
|
| 27 |
+
This repository contains the 650M-parameter DPLM-2 checkpoint. For the official
|
| 28 |
+
implementation, installation instructions, generation scripts, training
|
| 29 |
+
configuration, and evaluation utilities, see the
|
| 30 |
+
[bytedance/dplm](https://github.com/bytedance/dplm) repository.
|
| 31 |
+
|
| 32 |
+
## Model Details
|
| 33 |
+
|
| 34 |
+
- **Model type:** Multimodal discrete diffusion protein language model
|
| 35 |
+
- **Checkpoint:** `airkingbd/dplm2_650m`
|
| 36 |
+
- **Architecture:** ESM-style transformer for DPLM-2 (`EsmForDPLM2`)
|
| 37 |
+
- **Scale:** 650M parameters, 33 transformer layers, hidden size 1280, 20
|
| 38 |
+
attention heads
|
| 39 |
+
- **Vocabulary:** 8,229 tokens, covering amino-acid tokens, structure tokens,
|
| 40 |
+
and special tokens
|
| 41 |
+
- **Base initialization:** DPLM-2 training is initialized from a pretrained DPLM
|
| 42 |
+
sequence model to transfer evolutionary knowledge from large-scale sequence
|
| 43 |
+
pretraining
|
| 44 |
+
- **Structure tokenizer:** Uses the DPLM structure tokenizer
|
| 45 |
+
(`airkingbd/struct_tokenizer`) for structure-token based modeling and PDB
|
| 46 |
+
reconstruction
|
| 47 |
+
- **License:** Apache-2.0
|
| 48 |
+
- **Paper:** [DPLM-2: A Multimodal Diffusion Protein Language Model](https://arxiv.org/abs/2410.13782)
|
| 49 |
+
|
| 50 |
+
## Quick Start
|
| 51 |
+
|
| 52 |
+
Install the official DPLM codebase and dependencies:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
git clone --recursive https://github.com/bytedance/dplm.git
|
| 56 |
+
cd dplm
|
| 57 |
+
|
| 58 |
+
conda create -n dplm python=3.9 pip
|
| 59 |
+
conda activate dplm
|
| 60 |
+
bash scripts/install.sh
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
Load the pretrained DPLM-2 checkpoint:
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from byprot.models.dplm2 import MultimodalDiffusionProteinLanguageModel as DPLM2
|
| 67 |
+
|
| 68 |
+
dplm2 = DPLM2.from_pretrained("airkingbd/dplm2_650m").cuda()
|
| 69 |
+
dplm2 = dplm2.eval()
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Sequence-Structure Co-Generation
|
| 73 |
+
|
| 74 |
+
The official repository provides `generate_dplm2.py` for co-generation. The
|
| 75 |
+
default DPLM-2 sampling strategy is `annealing@2.0:0.1`, which starts with high
|
| 76 |
+
sampling temperature for diversity and anneals to a lower temperature for
|
| 77 |
+
designability.
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
model_name=dplm2_650m
|
| 81 |
+
sampling_strategy=annealing@2.0:0.1
|
| 82 |
+
output_dir=generation-results/${model_name}
|
| 83 |
+
|
| 84 |
+
python generate_dplm2.py \
|
| 85 |
+
--model_name airkingbd/${model_name} \
|
| 86 |
+
--task co_generation \
|
| 87 |
+
--sampling_strategy ${sampling_strategy} \
|
| 88 |
+
--num_seqs 50 \
|
| 89 |
+
--max_iter 500 \
|
| 90 |
+
--seq_lens 100 200 300 400 500 \
|
| 91 |
+
--saveto ${output_dir}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Generated sequences and structures are saved under
|
| 95 |
+
`generation-results/dplm2_650m/co_generation`. The official repository also
|
| 96 |
+
includes evaluation utilities for TM-score, RMSD, diversity, and related
|
| 97 |
+
structure metrics.
|
| 98 |
+
|
| 99 |
+
### Forward Folding
|
| 100 |
+
|
| 101 |
+
DPLM-2 can generate structures conditioned on input amino-acid sequences. The
|
| 102 |
+
official scripts use deterministic argmax decoding for 100 diffusion iterations:
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
model_name=dplm2_650m
|
| 106 |
+
output_dir=generation-results/${model_name}
|
| 107 |
+
|
| 108 |
+
python generate_dplm2.py \
|
| 109 |
+
--model_name airkingbd/${model_name} \
|
| 110 |
+
--task folding \
|
| 111 |
+
--input_fasta_path data-bin/cameo2022/aatype.fasta \
|
| 112 |
+
--max_iter 100 \
|
| 113 |
+
--unmasking_strategy deterministic \
|
| 114 |
+
--sampling_strategy argmax \
|
| 115 |
+
--saveto ${output_dir}
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
For custom sequences, provide a FASTA file via `--input_fasta_path`.
|
| 119 |
+
|
| 120 |
+
### Inverse Folding
|
| 121 |
+
|
| 122 |
+
DPLM-2 can predict amino-acid sequences conditioned on tokenized protein
|
| 123 |
+
structures:
|
| 124 |
+
|
| 125 |
+
```bash
|
| 126 |
+
model_name=dplm2_650m
|
| 127 |
+
output_dir=generation-results/${model_name}
|
| 128 |
+
|
| 129 |
+
python generate_dplm2.py \
|
| 130 |
+
--model_name airkingbd/${model_name} \
|
| 131 |
+
--task inverse_folding \
|
| 132 |
+
--input_fasta_path data-bin/cameo2022/struct.fasta \
|
| 133 |
+
--max_iter 100 \
|
| 134 |
+
--unmasking_strategy deterministic \
|
| 135 |
+
--sampling_strategy argmax \
|
| 136 |
+
--saveto ${output_dir}
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
To use a custom structure, first tokenize PDB files with the structure tokenizer:
|
| 140 |
+
|
| 141 |
+
```bash
|
| 142 |
+
python src/byprot/utils/protein/tokenize_pdb.py \
|
| 143 |
+
--input_pdb_folder /path/to/your/input/structure \
|
| 144 |
+
--output_dir /path/to/your/input/structure/tokenized_protein
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
Then pass the generated `struct.fasta` to `generate_dplm2.py`.
|
| 148 |
+
|
| 149 |
+
### Motif Scaffolding
|
| 150 |
+
|
| 151 |
+
DPLM-2 supports multimodal motif scaffolding by conditioning on both the
|
| 152 |
+
sequence and structure tokens of the motif and co-generating the scaffold
|
| 153 |
+
sequence and structure:
|
| 154 |
+
|
| 155 |
+
```bash
|
| 156 |
+
model_name=dplm2_650m
|
| 157 |
+
output_dir=./generation-results/${model_name}/motif_scaffold
|
| 158 |
+
|
| 159 |
+
python run/scaffold_generate_dplm2.py \
|
| 160 |
+
--model_name airkingbd/${model_name} \
|
| 161 |
+
--num_seqs 100 \
|
| 162 |
+
--saveto ${output_dir}
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
See the official repository for required motif data preparation and evaluation
|
| 166 |
+
steps.
|
| 167 |
+
|
| 168 |
+
## Training Data and Training Procedure
|
| 169 |
+
|
| 170 |
+
DPLM-2 is trained on experimental structures from PDB and AF2-predicted
|
| 171 |
+
structures from SwissProt. The authors provide the preprocessed training dataset
|
| 172 |
+
on Hugging Face as
|
| 173 |
+
[airkingbd/pdb_swissprot](https://huggingface.co/datasets/airkingbd/pdb_swissprot).
|
| 174 |
+
|
| 175 |
+
The official DPLM repository describes the following training setup for
|
| 176 |
+
`dplm2_650m`:
|
| 177 |
+
|
| 178 |
+
- Initialize from the pretrained DPLM checkpoint `airkingbd/dplm_650m`
|
| 179 |
+
- Use a warm-up training strategy for structure data scarcity
|
| 180 |
+
- Use LoRA to limit large parameter shifts during multimodal training
|
| 181 |
+
- Use `airkingbd/struct_tokenizer` for structure tokenization
|
| 182 |
+
|
| 183 |
+
The experiment configuration is available in the official repository at
|
| 184 |
+
`configs/experiment/dplm2/dplm2_650m.yaml`.
|
| 185 |
+
|
| 186 |
+
## Evaluation Summary
|
| 187 |
+
|
| 188 |
+
The DPLM repository reports DPLM-2 results on multiple protein generation and
|
| 189 |
+
understanding tasks. Selected 650M-scale results include:
|
| 190 |
+
|
| 191 |
+
- **Forward folding:** On the reported CAMEO 2022 split, DPLM-2 obtains RMSD
|
| 192 |
+
7.70 and TM-score 0.79; on the reported PDB date split, it obtains RMSD 5.30
|
| 193 |
+
and TM-score 0.83.
|
| 194 |
+
- **Motif scaffolding:** DPLM-2 succeeds on 18/24 benchmark cases with average
|
| 195 |
+
success rate 0.29 under the repository's motif consistency and overall
|
| 196 |
+
quality criteria.
|
| 197 |
+
- **Representation learning:** DPLM-2 provides structure-aware representations
|
| 198 |
+
and is evaluated on downstream protein prediction tasks including
|
| 199 |
+
thermostability, protein-protein interaction, metal ion binding, EC, GO, and
|
| 200 |
+
DeepLoc benchmarks.
|
| 201 |
+
|
| 202 |
+
For full tables, baselines, metrics, and evaluation details, refer to the
|
| 203 |
+
[DPLM-2 paper](https://arxiv.org/abs/2410.13782), the
|
| 204 |
+
[DPLM-2.1 paper](https://arxiv.org/abs/2504.11454), and the official
|
| 205 |
+
[bytedance/dplm](https://github.com/bytedance/dplm) repository.
|
| 206 |
+
|
| 207 |
+
## Citation
|
| 208 |
+
|
| 209 |
+
If you use this checkpoint, please cite the DPLM and DPLM-2 papers:
|
| 210 |
+
|
| 211 |
+
```bibtex
|
| 212 |
+
@inproceedings{wang2024dplm,
|
| 213 |
+
title={Diffusion Language Models Are Versatile Protein Learners},
|
| 214 |
+
author={Wang, Xinyou and Zheng, Zaixiang and Ye, Fei and Xue, Dongyu and Huang, Shujian and Gu, Quanquan},
|
| 215 |
+
booktitle={International Conference on Machine Learning},
|
| 216 |
+
year={2024}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
@inproceedings{wang2025dplm2,
|
| 220 |
+
title={DPLM-2: A Multimodal Diffusion Protein Language Model},
|
| 221 |
+
author={Wang, Xinyou and Zheng, Zaixiang and Ye, Fei and Xue, Dongyu and Huang, Shujian and Gu, Quanquan},
|
| 222 |
+
booktitle={International Conference on Learning Representations},
|
| 223 |
+
year={2025}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
@inproceedings{hsieh2025dplm2_1,
|
| 227 |
+
title={Elucidating the Design Space of Multimodal Protein Language Models},
|
| 228 |
+
author={Hsieh, Cheng-Yen and Wang, Xinyou and Zhang, Daiheng and Xue, Dongyu and Ye, Fei and Huang, Shujian and Zheng, Zaixiang and Gu, Quanquan},
|
| 229 |
+
booktitle={International Conference on Machine Learning},
|
| 230 |
+
year={2025}
|
| 231 |
+
}
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
## Acknowledgements
|
| 235 |
+
|
| 236 |
+
DPLM builds on and acknowledges prior work and resources including ByProt,
|
| 237 |
+
EvoDiff, SaProt, ESM, LM-Design, EigenFold, MultiFlow, FrameFlow, and
|
| 238 |
+
OpenFold-related structure modeling utilities. See the official repository for
|
| 239 |
+
the complete acknowledgements and implementation details.
|