Run this model with HF Jobs
Run GleghornLab/DSM_650 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/GleghornLab/DSM_650. 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/GleghornLab/DSM_650 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 GleghornLab/DSM_650 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GleghornLab/DSM_650 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import ESM_Diff model = ESM_Diff.from_pretrained("GleghornLab/DSM_650", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files1236 unmodified lines101112131415161718192021222324252687 unmodified lines1141151161171181191201213 unmodified lines1251261271281291301311321331341351361371381391401411421431441451461471483 unmodified lines152153154155156157214 unmodified lines372373374375# DSM: Diffusion Models for Protein Sequence Generation### Note: This readme is shared between our GitHub and Huggingface pages.6 unmodified lines- [Training](#training)- [Evaluation](#evaluation)- [Results](#results)- [Cite](#Cite)## IntroductionDSM (Diffusion Sequence Model) is a novel Protein Language Model (pLM) developed in collaboration between the Gleghorn Lab and [Synthyra](https://synthyra.com/). It was trained with masked diffusion to enable both high-quality representation learning and generative protein design, detailed extensively in our [preprint](https://arxiv.org/abs/2506.08293). This repository contains the code for training and evaluating DSM and its variants.DSM is capable of generating diverse, biomimetic sequences that align with expected amino acid compositions, secondary structures, and predicted functions, even under high corruption rates. Furthermore, DSM's learned representations match or exceed those of comparably sized pLMs on various downstream tasks. The repository also includes DSM-ppi, a variant fine-tuned to generate protein binders by attending to target sequences.## ModelsThe following models are available on Hugging Face:- **Base DSM Models**:- [GleghornLab/DSM_150](https://huggingface.co/GleghornLab/DSM_150) - 150M parameter DSM model87 unmodified lines```### 3. Conditional Generation (e.g., Binders - using DSM-ppi)If using DSM-ppi, the input format is specific for generating a binder (SeqB) for a target (SeqA).```python# from models.modeling_dsm import DSM_ppi# model_binder = DSM_ppi.from_pretrained("GleghornLab/DSM_650_ppi_lora").to(device).eval()3 unmodified linesmodel_binder = DSM.from_pretrained("Synthyra/DSM_ppi_full").to(device).eval()target_seq = "TARGETSEQUENCEAMINOACIDS"# For binder generation, the 'interactor' (SeqB) part is what gets generated/filled.# Start with a fully masked interactor of desired length.interactor_template_len = 20interactor_template = ''.join([mask_token] * interactor_template_len)combined_input_str = target_seq + '<eos>' + interactor_templatebinder_template_tokens = tokenizer.encode(combined_input_str, add_special_tokens=True).to(device)output = model_binder.mask_diffusion_generate(input_tokens=binder_template_tokens,step_divisor=100, # lower is slower but bettertemperature=1.0, # sampling temperatureremasking="random", # strategy for remasking tokens not kept)target, binder = model.decode_dual_input(output, seperator='<eos>;)# Parse out the generated interactor part based on EOS tokens.# Example: generated_full_seq_str.split(model_binder.tokenizer.eos_token)[1]print(f"Generated binder {binder[0]}")3 unmodified linesGenerated binder HRHHHRRPTHARETEWLARMRLGIAEHQRIAVPRSDLEPDQMRERAADNQRLVKEYDQVIDHQTEGSTERLFEVLRVWEQVNTEQAHHEASAALEFGRVGYPDDEGGRAFYTQANAHKKDLVEYIGGIDEDAKWDPRIAWLMPEGGQPVKATVIGVSEERINGLKVLDDHWGRERRLWLINLFTALQAYDDPTRPTQVTLTPATDQLTNDVQYLLLSTRYTPPGVTTAVKIRKLDGRTLKVLTTEAPYVVRGATLS```## DemosThere are various demos with many more to come. For example, in `demo_dsm_ppi_full.py` (run by `python -m demos.demo_dsm_ppi_full`) we perform a test on DSM-ppi.We take 1000 proteins pairs from BIOGRID (real protein-protein interactions) and 1000 from Negatome (non interacting protein pairs) and mask the second sequence (SeqB) by 50%.214 unmodified linesprimaryClass={q-bio.BM},url={https://arxiv.org/abs/2506.08293},}```12345676 unmodified lines141516171819202122232425262728293087 unmodified lines1181191201211221233 unmodified lines1271281291301311321331341351361371381391401411421431441451461471481491501511521531541553 unmodified lines159160161162163164165166167168169170171172173214 unmodified lines388389390391---library_name: transformerstags: []---# DSM: Diffusion Models for Protein Sequence Generation### Note: This readme is shared between our GitHub and Huggingface pages.6 unmodified lines- [Training](#training)- [Evaluation](#evaluation)- [Results](#results)- [Cite](#cite)## IntroductionDSM (Diffusion Sequence Model) is a novel Protein Language Model (pLM) developed in collaboration between the Gleghorn Lab and [Synthyra](https://synthyra.com/). It was trained with masked diffusion to enable both high-quality representation learning and generative protein design. This repository contains the code for training, evaluating, and applying DSM and its variants.DSM is capable of generating diverse, biomimetic sequences that align with expected amino acid compositions, secondary structures, and predicted functions. Furthermore, DSM's learned representations match or exceed those of comparably sized pLMs on various downstream tasks. DSM is detailed extensively in our [preprint](https://arxiv.org/abs/2506.08293) (which is currently in review). Beyond the base and PPI variants, we are currently training versions to jointly diffuse over sequence and foldseek tokens, as well as [Annotation Vocabulary](https://www.biorxiv.org/content/10.1101/2024.07.30.605924v1) tokens. Since the preprint release, Synthyra has trained [Synthyra/DSM_ppi_full](https://huggingface.co/Synthyra/DSM_ppi_full) which neglects the LoRA PPI training in favor for full finetuning. Additionally, the sequences SeqA and SeqB are jointly masked instead of just SeqB in the original version. We plan on adding the **many** new results to the second version of the preprint and eventual journal article.## ModelsRelevant Huggingface hosted models and datasets- **Base DSM Models**:- [GleghornLab/DSM_150](https://huggingface.co/GleghornLab/DSM_150) - 150M parameter DSM model87 unmodified lines```### 3. Conditional Generation (e.g., Binders - using DSM-ppi)```python# from models.modeling_dsm import DSM_ppi# model_binder = DSM_ppi.from_pretrained("GleghornLab/DSM_650_ppi_lora").to(device).eval()3 unmodified linesmodel_binder = DSM.from_pretrained("Synthyra/DSM_ppi_full").to(device).eval()# BBF-14target_seq = "MGTPLWALLGGPWRGTATYEDGTKVTLDYRYTRVSPDRLRADVTYTTPDGTTLEATVDLWKDANGVIRYHATYPDGTSADGTLTQLDADTLLATGTYDDGTKYTVTLTRVAPGSGWHHHHHH"# For binder generation, the 'interactor' (SeqB) part is what gets generated/filled.# Start with a fully masked interactor of desired length.interactor_template_len = 256interactor_template = ''.join([mask_token] * interactor_template_len)combined_input_str = target_seq + '<eos>' + interactor_templateinput_tokens = tokenizer.encode(combined_input_str, add_special_tokens=True, return_tensors='pt').to(device)output = model_binder.mask_diffusion_generate(tokenizer=tokenizer,input_tokens=input_tokens,step_divisor=10, # lower is slower but bettertemperature=1.0, # sampling temperatureremasking="random", # strategy for remasking tokens not keptpreview=False, # set this to True to watch the mask tokens get rilled in real timeslow=False, # adds a small delay to the real time filling (because it is usually very fast and watching carefully is hard!)return_trajectory=False # set this to True to return the trajectory of the generation (what you watch in the preview)) # Note: output will be a tuple if return_trajectory is Truetarget, binder = model.decode_dual_input(output, seperator='<eos>')# Parse out the generated interactor part based on EOS tokens.# Example: generated_full_seq_str.split(model_binder.tokenizer.eos_token)[1]print(f"Generated binder {binder[0]}")3 unmodified linesGenerated binder HRHHHRRPTHARETEWLARMRLGIAEHQRIAVPRSDLEPDQMRERAADNQRLVKEYDQVIDHQTEGSTERLFEVLRVWEQVNTEQAHHEASAALEFGRVGYPDDEGGRAFYTQANAHKKDLVEYIGGIDEDAKWDPRIAWLMPEGGQPVKATVIGVSEERINGLKVLDDHWGRERRLWLINLFTALQAYDDPTRPTQVTLTPATDQLTNDVQYLLLSTRYTPPGVTTAVKIRKLDGRTLKVLTTEAPYVVRGATLS```Folded with Chai1:`Synthyra/DSM_ppi_full` was actually trained to fill masks from any part of SeqA and SeqB. That means you can fully hallucinate plausibly interacting protein pairs.## DemosThere are various demos with many more to come. For example, in `demo_dsm_ppi_full.py` (run by `python -m demos.demo_dsm_ppi_full`) we perform a test on DSM-ppi.We take 1000 proteins pairs from BIOGRID (real protein-protein interactions) and 1000 from Negatome (non interacting protein pairs) and mask the second sequence (SeqB) by 50%.214 unmodified linesprimaryClass={q-bio.BM},url={https://arxiv.org/abs/2506.08293},}```
README.md+33-17