Run this model with HF Jobs
Run Synthyra/DPLM2-150M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Synthyra/DPLM2-150M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Synthyra/DPLM2-150M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Synthyra/DPLM2-150M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Synthyra/DPLM2-150M with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, EsmForDPLM2 tokenizer = AutoTokenizer.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True) model = EsmForDPLM2.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109---library_name: transformerstags: []---# NOTEThe GitHub with the implementation and requirements can be found [here](https://github.com/Synthyra/FastPLMs.git).# DPLM2Synthyra DPLM2 checkpoints are HuggingFace AutoModel compatible and include FastPLMs embedding helpers.## Supported models```pythonmodel_dict = {"Synthyra/DPLM2-150M": "airkingbd/dplm2_150m","Synthyra/DPLM2-650M": "airkingbd/dplm2_650m","Synthyra/DPLM2-3B": "airkingbd/dplm2_3b",}```## Use with transformers```pythonimport torchfrom transformers import AutoModel, AutoModelForMaskedLMmodel_path = "Synthyra/DPLM2-150M"model = AutoModel.from_pretrained(model_path, trust_remote_code=True, dtype=torch.float16).eval()tokenizer = model.tokenizerbatch = tokenizer(["MPRTEIN", "MSEQWENCE"], padding=True, return_tensors="pt")with torch.no_grad():hidden = model(**batch).last_hidden_statemlm = AutoModelForMaskedLM.from_pretrained(model_path, trust_remote_code=True, dtype=torch.float16).eval()with torch.no_grad():logits = mlm(**batch).logits```## DPLM2 modality typesDPLM2 infers `type_ids` automatically from `input_ids` and `attention_mask` when they are not provided.## Attention backends`sdpa` (PyTorch Scaled Dot Product Attention) is the default.| Backend | Key | Notes || :--- | :--- | :--- || PyTorch SDPA | `"sdpa"` | Default. Exact numerics, stable on all hardware. || Flash Attention | `"kernels_flash"` | Fastest on Ampere/Hopper GPUs. Requires `pip install kernels` (pre-built β no hours-long compilation). Outputs are not bitwise identical to SDPA due to online softmax reordering; differences are often small but not guaranteed to be inconsequential β use `"sdpa"` if exact numerics matter. || Flex Attention | `"flex"` | Skips padding tokens via block mask β faster on variable-length batches. Near-exact numerics. First use compiles a Triton kernel (30β120 s). Best combined with `torch.compile`. || Auto | `"auto"` | Picks the best available: `kernels_flash` β `flex` β `sdpa`. |Set via config before loading, or change on the model after loading (DPLM2 propagates the change to all attention layers immediately):```pythonfrom transformers import AutoConfig, AutoModel# Option 1: set before loadingconfig = AutoConfig.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True)config.attn_backend = "flex"model = AutoModel.from_pretrained("Synthyra/DPLM2-150M", config=config, trust_remote_code=True)# Option 2: set after loadingmodel = AutoModel.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True)model.attn_backend = "flex" # propagates to all attention layers in-place```## Embed datasetsAll DPLM2 models inherit `EmbeddingMixin`, so you can call `model.embed_dataset(...)` directly.## Citations```bibtex@article{wang2024dplm2,title={DPLM-2: A Multimodal Diffusion Protein Language Model},author={Wang, Xinyou and Ye, Zaixiang and Huang, Fei and Cao, Dongyan and Liang, Shujian and Huang, Liang},journal={arXiv preprint arXiv:2410.13782},year={2024}}``````bibtex@misc{FastPLMs,author={Hallee, Logan and Bichara, David and Gleghorn, Jason P.},title={FastPLMs: Fast, efficient, protein language model inference from Huggingface AutoModel.},year={2024},url={https://huggingface.co/Synthyra/ESMplusplus_small},DOI={10.57967/hf/3726},publisher={Hugging Face}}``````bibtex@article{dong2024flexattention,title={Flex Attention: A Programming Model for Generating Optimized Attention Kernels},author={Dong, Juechu and Feng, Boyuan and Guessous, Driss and Liang, Yanbo and He, Horace},journal={arXiv preprint arXiv:2412.05496},year={2024}}``````bibtex@inproceedings{paszke2019pytorch,title={PyTorch: An Imperative Style, High-Performance Deep Learning Library},author={Paszke, Adam and Gross, Sam and Massa, Francisco and Lerer, Adam and Bradbury, James and Chanan, Gregory and Killeen, Trevor and Lin, Zeming and Gimelshein, Natalia and Antiga, Luca and Desmaison, Alban and K{\"o}pf, Andreas and Yang, Edward and DeVito, Zach and Raison, Martin and Tejani, Alykhan and Chilamkurthy, Sasank and Steiner, Benoit and Fang, Lu and Bai, Junjie and Chintala, Soumith},booktitle={Advances in Neural Information Processing Systems 32},year={2019}}```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109---library_name: transformerstags: []---# NOTEThe GitHub with the implementation and requirements can be found [here](https://github.com/Synthyra/FastPLMs.git).# DPLM2Synthyra DPLM2 checkpoints are HuggingFace AutoModel compatible and include FastPLMs embedding helpers.## Supported models```pythonmodel_dict = {"Synthyra/DPLM2-150M": "airkingbd/dplm2_150m","Synthyra/DPLM2-650M": "airkingbd/dplm2_650m","Synthyra/DPLM2-3B": "airkingbd/dplm2_3b",}```## Use with transformers```pythonimport torchfrom transformers import AutoModel, AutoModelForMaskedLMmodel_path = "Synthyra/DPLM2-150M"model = AutoModel.from_pretrained(model_path, trust_remote_code=True, dtype=torch.float16).eval()tokenizer = model.tokenizerbatch = tokenizer(["MPRTEIN", "MSEQWENCE"], padding=True, return_tensors="pt")with torch.no_grad():hidden = model(**batch).last_hidden_statemlm = AutoModelForMaskedLM.from_pretrained(model_path, trust_remote_code=True, dtype=torch.float16).eval()with torch.no_grad():logits = mlm(**batch).logits```## DPLM2 modality typesDPLM2 infers `type_ids` automatically from `input_ids` and `attention_mask` when they are not provided.## Attention backends`sdpa` (PyTorch Scaled Dot Product Attention) is the default.| Backend | Key | Notes || :--- | :--- | :--- || PyTorch SDPA | `"sdpa"` | Default. Exact numerics, stable on all hardware. || Flash Attention | `"kernels_flash"` | Fastest on Ampere/Hopper GPUs. Requires `pip install kernels` (pre-built β no hours-long compilation). Outputs are not bitwise identical to SDPA due to online softmax reordering; differences are often small but not guaranteed to be inconsequential β use `"sdpa"` if exact numerics matter. || Flex Attention | `"flex"` | Skips padding tokens via block mask β faster on variable-length batches. Near-exact numerics. First use compiles a Triton kernel (30β120 s). Best combined with `torch.compile`. || Auto | `"auto"` | Picks the best available: `kernels_flash` β `flex` β `sdpa`. |Set via config before loading, or change on the model after loading (DPLM2 propagates the change to all attention layers immediately):```pythonfrom transformers import AutoConfig, AutoModel# Option 1: set before loadingconfig = AutoConfig.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True)config.attn_backend = "flex"model = AutoModel.from_pretrained("Synthyra/DPLM2-150M", config=config, trust_remote_code=True)# Option 2: set after loadingmodel = AutoModel.from_pretrained("Synthyra/DPLM2-150M", trust_remote_code=True)model.attn_backend = "flex" # propagates to all attention layers in-place```## Embed datasetsAll DPLM2 models inherit `EmbeddingMixin`, so you can call `model.embed_dataset(...)` directly.## Citations```bibtex@article{wang2024dplm2,title={DPLM-2: A Multimodal Diffusion Protein Language Model},author={Wang, Xinyou and Ye, Zaixiang and Huang, Fei and Cao, Dongyan and Liang, Shujian and Huang, Liang},journal={arXiv preprint arXiv:2410.13782},year={2024}}``````bibtex@misc{FastPLMs,author={Hallee, Logan and Bichara, David and Gleghorn, Jason P.},title={FastPLMs: Fast, efficient, protein language model inference from Huggingface AutoModel.},year={2024},url={https://huggingface.co/Synthyra/ESMplusplus_small},DOI={10.57967/hf/3726},publisher={Hugging Face}}``````bibtex@article{dong2024flexattention,title={Flex Attention: A Programming Model for Generating Optimized Attention Kernels},author={Dong, Juechu and Feng, Boyuan and Guessous, Driss and Liang, Yanbo and He, Horace},journal={arXiv preprint arXiv:2412.05496},year={2024}}``````bibtex@inproceedings{paszke2019pytorch,title={PyTorch: An Imperative Style, High-Performance Deep Learning Library},author={Paszke, Adam and Gross, Sam and Massa, Francisco and Lerer, Adam and Bradbury, James and Chanan, Gregory and Killeen, Trevor and Lin, Zeming and Gimelshein, Natalia and Antiga, Luca and Desmaison, Alban and K{\"o}pf, Andreas and Yang, Edward and DeVito, Zach and Raison, Martin and Tejani, Alykhan and Chilamkurthy, Sasank and Steiner, Benoit and Fang, Lu and Bai, Junjie and Chintala, Soumith},booktitle={Advances in Neural Information Processing Systems 32},year={2019}}```
README.md+109-109