[来源关键摘录] 字节跳动官方 Apache 2.0 开源仓库,集成 DPLM、DPLM-2 与 DPLM-2.1 训练推理脚本及预训练模型权重。
[正文前段节选] Skip to content
Navigation Menu
Appearance settings
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Repository navigation
Public archive
NotificationsYou must be signed in to change notification settings
Star349 (349)You must be signed in to star a repository
The Family of Diffusion Protein Language Models (DPLM)
bytedance.github.io/dplm/
Apache-2.0 license
Custom properties
Report repository
BranchesTags
Open more actions menu
Latest commit
Folders and files
Last commit message
Last commit date
vendor/openfold
.pre-commit-config.yaml
generate_dplm.py
generate_dplm2.py
requirements.txt
View all files
Repository files navigation
This repository contains the official implementation of training and inference as well as the pre-trained weights for the Family of Diffusion Protein Language Models (DPLM), including:
DPLM from ICML'24 paper "Diffusion Language Models Are Versatile Protein Learners", which introduces diffusion protein language model (DPLM), a versatile protein language model that demonstrates strong generative and predictive capabilities for protein sequences.
DPLM-2 from ICLR'25 paper "DPLM-2: A Multimodal Diffusion Protein Language Model", a multimodal protein foundation model that extends discrete diffusion protein language model to accommodate both sequences and structures.
ICML'25 spotlight paper "Elucidating the Design Space of Multimodal Protein Language Models", where we elucidate the challenges of structure modeling of multimodal protein language models (e.g., DPLM-2 and ESM3) and propose advanced designs for better structure modeling. We have released the finer-grained bit-based generative modeling (DPLM-2 Bit). The full implementation of the paper will be released soon.
Key Features 🔑
Specifically, the DPLM family exhibits impressive performance in protein (structure and sequence) co-generation, any-to-any conditional generation (e.g., folding, inverse folding, and motif scaffolding), and representation learning.
We develop DPLM based on the ByProt. This repository contains pretraining scripts for DPLM and running scripts for various protein generation and understanding tasks, as detailed below:
Unconditional protein generation:
DPLM is capable of unconditionally generating protein sequences with reasonable predicted structures. DPLM-2 can generate diverse and highly plausible proteins through simultaneous structure-sequence co-generation.
Sequence-conditioned generation (forward folding):
DPLM-2 can generate reasonable protein structure given the input protein sequence, achieving close performance with the strong folding model (e.g., ESMFold).
Structure-conditioned generation (inverse folding):
DPLM and DPLM-2 can produce sequences that can confidently fold into the given backbone structure.
Motif scaffolding:
DPLM can generate reasonable scaffold sequences given specific functional motifs. DPLM-2 achieves more successful motif scaffolding through multimodal motif conditioning.
Representation learning:
DPLM is a superior protein sequence representation learner, while DPLM-2 offers structure-aware protein represenrations, demonstrating impressive performance across a variety of protein predictive tasks.
Controllable generation:
DPLM enjoys plug-and-play programmability, generating samples satisfying provided secondary structure annotations.
Controllable/guided generation with discrete diffusion classifier guidance.
Representation learning of DPLM-2
"Diffusion Language Models Are Versatile Protein Learners." Wang et al., In ICML 2024
"DPLM-2: A Multimodal Diffusion Protein Language Model." Wang et al., In ICLR 2025
[2025-07] We update the default sampling strategy of DPLM-2 to annealing@2.0:0.1.
[2025-04] Our latest work DPLM-2.1, which focuses on analysis and better protein structure modeling of multimodal protein language models, is accepted to ICML'25 Spotlight! Check Elucidating the Design Space of Multimodal Protein Language Models. We have release the implementation of finer-grained and better structure modeling (DPLM-2 Bit). The full implementation will be released soon.
[2024-10] Check out our new work DPLM-2, a multimodal protein foundation model that extends DPLM to simultaneously model, understand, and generate both sequences and structures!
[2024-03] We release DPLM, a versatile protein language model that demonstrates strong generative and predictive capabilities for protein sequences!
Table of Contents 📚
Installation
Load Pretrained Models
Generation Examples
Model Checkpoints
Advanced Usage
Unconditional protein (co-)generation
Protein sequence generation (DPLM)
Protein sequence-structure co-generation (DPLM-2 & DPLM-2-Bit)
Sequence-conditioned Generation: Forward Folding
Structure-conditioned generation: inverse folding
Motif scaffolding
Representation Learning
Acknowledgements
# clone project
git clone --recursive https://url/to/this/repo/dplm.git
# create conda virtual environment
env_name=dplm
conda create -n ${env_name} python=3.9 pip
conda activate ${env_name}
# automatically install everything else
bash scripts/install.sh
Users can load DPLM/DPLM-2 checkpoint by:
from byprot.models.dplm import DiffusionProteinLanguageModel as DPLM
from byprot.models.dplm2 import MultimodalDiffusionProteinLanguageModel as DPLM2
from byprot.models.dplm2 import DPLM2Bit
dplm = DPLM.from_pretrained("airkingbd/dplm_650m").cuda()
dplm2 = DPLM2.from_pretrained("airkingbd/dplm2_650m").cuda()
dplm2_bit = DPLM2Bit.from_pretrained("airkingbd/dplm2_bit_650m").cuda()
Protein sequence generation
from generate_dplm import initialize_generation
input_tokens = initialize_generation(
tokenizer=dplm.tokenizer,
device=next(dplm.parameters()).device
samples = dplm.generate(
input_tokens=input_tokens,
max_iter=500,
print([''.join(seq.split(' ')) for seq in dplm.tokenizer.batch_decode(samples, skip_special_tokens=True)])
Protein sequence-structure co-generation
User can check the generated sequence and structure in the ./generation-results folder.
from generate_dplm2 import initialize_generation, save_results
task="co_generation",
tokenizer=dplm2.tokenizer,
device=next(dplm2.parameters()).device
samples = dplm2.generate(
save_results(
outputs=samples,
save_dir="./generation-results/dplm2_generation",
struct_tokenizer=dplm2.struct_tokenizer, save_pdb=True
samples = dplm2_bit.generate(
save_dir="./generation-results/dplm2_bit_generation",
tokenizer=dplm2_bit.tokenizer,
struct_tokenizer=dplm2_bit.struct_tokenizer
Access pretrained models in varying sizes:
150M parameters
650M parameters
3B parameters
dplm2-bit-650m
We pretrain DPLM on the UniRef50 dataset, which contains about 42 million protein sequences. We obtain the preprocessed UniRef50 dataset provided by EvoDiff (Alamdari et al, 2023), which can be downloaded from this link. After downloading, please place the dataset in the ./data-bin/uniref50 folder.
We also provide the preprocessed dataset in HuggingFace datasets format, which we recommend to use. User can download the HF dataset locally in advance for faster loading by:
bash scripts/download_uniref50_hf.sh
Example of training
We train DPLM with approximately 1 million tokens per batch for 100,000 training steps.
The following command is run on one node with 8 A100 GPUs. If you want to train on multiple nodes, you can adjust the total number of tokens by ensuring that max_tokens * accumulate_grad_batches*#GPUs is approximately 1 million.
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
max_tokens=8192
accumulate_grad_batches=16
[...内容已截断,完整版请查看原文或 Wayback 快照]