Official code for the CVPR2026 paper "MMCP-GEN: A Modality-Extensible Diffusion Language Model for Conditional Protein Sequence Generation"
Python
5
15 commits
updated May 28, 2026
This repository provides a multimodal conditional training framework for protein sequence generation.
It focuses on reusable MMCP-GEN modules and an end-to-end training template.
This project extends DPLM with multimodal conditions (e.g., structure, ligand, function annotations, text) and injects them into the language model through lightweight plug-in components.
The two key files are:
mmcp_modules.py: reusable MMCP core modulesTrain_mmcp_gen.py: end-to-end MMCP-GEN training templatesrc/, scripts/, analysis/, assets/, vendor/mmcp_modules.pyTrain_mmcp_gen.pymultimodal_encoders.pytrain_mmcp.py, train_multimodal_dplm.py, generate_dplm.pyrequirements.txt, env.yml, setup.py, setup.cfgmmcp_modules.pymmcp_modules.py includes four key building blocks:
ModalityIndicatorHead
MMCP_LQ (Learnable Query Fusion)
Q_out.CrossAttentionAdapter
H and condition summary S.delta (with learnable scaling) to inject into backbone layers.Adapter Attachment Utilities
attach_adapters_to_modules(...): attaches adapters to target layers.register_adapter_hooks(...): registers forward hooks for non-invasive condition injection.Design goal: add multimodal controllability to the original DPLM backbone.
Train_mmcp_gen.pyTrain_mmcp_gen.py is an MMCP-GEN training template with a full pipeline:
DPLM_650M, fallback to Hugging Face, then fallback dummy model)L_CEL_align (InfoNCE)python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Or with Conda:
conda env create -f env.yml
conda activate dplm
python Train_mmcp_gen.py \
--epochs 1 \
--batch_size 8 \
--lr 1e-5 \
--K_shared 16 \
--K_per_modality 2 \
--gamma 1.0 \
--save_path mmcp_gen_checkpoint.pt
If using Inhouse data:
python Train_mmcp_gen.py \
--use_inhouse \
--inhouse_data_path /path/to/your/inhouse.jsonl \
--max_seq_len 256 \
--structure_dim 128 \
--batch_size 8 \
--epochs 5
Train_mmcp_gen.py)--K_shared: number of shared queries--K_per_modality: number of modality-specific queries per modality--adapter_n_heads: attention heads used in adapters--gamma: weight for alignment loss--modality_dropout_prob: modality dropout probability--disable_*_encoder / --freeze_*: enable/freeze each modality encoderDefault checkpoint output:
mmcp_gen_checkpoint.ptTypically contains:
If you build on this repository, citations and references are welcome.
If you find our work or code useful for your research, please consider citing:
@InProceedings{An_2026_CVPR,
author = {An, Zeyu and Lin, Wanyu and Tan, Feng and Wang, Shujun},
title = {MMCP-GEN: A Modality-Extensible Diffusion Language Model for Conditional Protein Sequence Generation},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2026},
pages = {15762-15772}
}
Official code for the CVPR2026 paper "MMCP-GEN: A Modality-Extensible Diffusion Language Model for Conditional Protein Sequence Generation"
Python
5
15 commits
updated May 28, 2026
This repository provides a multimodal conditional training framework for protein sequence generation.
It focuses on reusable MMCP-GEN modules and an end-to-end training template.
This project extends DPLM with multimodal conditions (e.g., structure, ligand, function annotations, text) and injects them into the language model through lightweight plug-in components.
The two key files are:
mmcp_modules.py: reusable MMCP core modulesTrain_mmcp_gen.py: end-to-end MMCP-GEN training templatesrc/, scripts/, analysis/, assets/, vendor/mmcp_modules.pyTrain_mmcp_gen.pymultimodal_encoders.pytrain_mmcp.py, train_multimodal_dplm.py, generate_dplm.pyrequirements.txt, env.yml, setup.py, setup.cfgmmcp_modules.pymmcp_modules.py includes four key building blocks:
ModalityIndicatorHead
MMCP_LQ (Learnable Query Fusion)
Q_out.CrossAttentionAdapter
H and condition summary S.delta (with learnable scaling) to inject into backbone layers.Adapter Attachment Utilities
attach_adapters_to_modules(...): attaches adapters to target layers.register_adapter_hooks(...): registers forward hooks for non-invasive condition injection.Design goal: add multimodal controllability to the original DPLM backbone.
Train_mmcp_gen.pyTrain_mmcp_gen.py is an MMCP-GEN training template with a full pipeline:
DPLM_650M, fallback to Hugging Face, then fallback dummy model)L_CEL_align (InfoNCE)python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Or with Conda:
conda env create -f env.yml
conda activate dplm
python Train_mmcp_gen.py \
--epochs 1 \
--batch_size 8 \
--lr 1e-5 \
--K_shared 16 \
--K_per_modality 2 \
--gamma 1.0 \
--save_path mmcp_gen_checkpoint.pt
If using Inhouse data:
python Train_mmcp_gen.py \
--use_inhouse \
--inhouse_data_path /path/to/your/inhouse.jsonl \
--max_seq_len 256 \
--structure_dim 128 \
--batch_size 8 \
--epochs 5
Train_mmcp_gen.py)--K_shared: number of shared queries--K_per_modality: number of modality-specific queries per modality--adapter_n_heads: attention heads used in adapters--gamma: weight for alignment loss--modality_dropout_prob: modality dropout probability--disable_*_encoder / --freeze_*: enable/freeze each modality encoderDefault checkpoint output:
mmcp_gen_checkpoint.ptTypically contains:
If you build on this repository, citations and references are welcome.
If you find our work or code useful for your research, please consider citing:
@InProceedings{An_2026_CVPR,
author = {An, Zeyu and Lin, Wanyu and Tan, Feng and Wang, Shujun},
title = {MMCP-GEN: A Modality-Extensible Diffusion Language Model for Conditional Protein Sequence Generation},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2026},
pages = {15762-15772}
}