Run this model with HF Jobs
Run GleghornLab/DSM_150 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_150. 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_150 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_150 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GleghornLab/DSM_150 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import ESM_Diff model = ESM_Diff.from_pretrained("GleghornLab/DSM_150", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files77 unmodified lines78798081828384858687888990919 unmodified lines1011021031041051061071081091101111121131141159 unmodified lines1251261271281291301311321336 unmodified lines14014114214314414514614714814942 unmodified lines19219319419519619719877 unmodified lineslength = 100mask_token = tokenizer.mask_token# optionally, enforce starting with methionineinput_template = tokenizer.encode('M' + ''.join([mask_token] * (length - 1)), add_special_tokens=True).to(device)output = model.mask_diffusion_generate(input_tokens=input_template,step_divisor=100, # lower is slower but bettertemperature=1.0, # sampling temperatureremasking="random", # strategy for remasking tokens not keptpreview=False #)generated_sequences = model.decode_output(output)print(f"Generated sequence: {generated_sequences[0]}")9 unmodified lines```python# Mask Filling / Inpaintingtemplate_sequence = "MA<mask><mask><mask>KEG<mask><mask>STL"template_tokens = model.tokenizer.encode(template_sequence, add_special_tokens=True).to(device)filled_ids = model.mask_diffusion_generate(input_tokens=template_tokens,step_divisor=100, # lower is slower but bettertemperature=1.0, # sampling temperatureremasking="random", # strategy for remasking tokens not keptpreview=False)generated_sequences = model.decode_output(output)print(f"Generated sequence: {generated_sequences[0]}")9 unmodified lines# model_binder = DSM_ppi.from_pretrained("GleghornLab/DSM_650_ppi_lora").to(device).eval()# The lora version from the paper leads to unreliable outputs# Synthyra has generously trained a version through full fine tuningfrom models.modeling_dsm import DSMmodel_binder = DSM.from_pretrained("Synthyra/DSM_ppi_full").to(device).eval()# BBF-14target_seq = "MGTPLWALLGGPWRGTATYEDGTKVTLDYRYTRVSPDRLRADVTYTTPDGTTLEATVDLWKDANGVIRYHATYPDGTSADGTLTQLDADTLLATGTYDDGTKYTVTLTRVAPGSGWHHHHHH"6 unmodified linesinput_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 time42 unmodified linesseqa, seqb = 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"SeqA: {seqa[0][4:]}") # remove cls tokenprint(f"SeqB: {seqb[0]}")```77 unmodified lines78798081828384858687888990919293949 unmodified lines1041051061071081091101111121131141151161171181191201219 unmodified lines1311321331341351361371386 unmodified lines14514614714814915015115215315442 unmodified lines19719819920020120220377 unmodified lineslength = 100mask_token = tokenizer.mask_token# optionally, enforce starting with methionineinput_tokens = tokenizer.encode('M' + ''.join([mask_token] * (length - 1)), add_special_tokens=True, return_tensors='pt').to(device)output = model.mask_diffusion_generate(tokenizer=tokenizer,input_tokens=input_tokens,step_divisor=100, # 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 Truegenerated_sequences = model.decode_output(output)print(f"Generated sequence: {generated_sequences[0]}")9 unmodified lines```python# Mask Filling / Inpaintingtemplate_sequence = "MA<mask><mask><mask>KEG<mask><mask>STL"input_tokens = tokenizer.encode(template_sequence, add_special_tokens=True, return_tensors='pt').to(device)output = model.mask_diffusion_generate(tokenizer=tokenizer,input_tokens=input_tokens,step_divisor=100, # 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 Truegenerated_sequences = model.decode_output(output)print(f"Generated sequence: {generated_sequences[0]}")9 unmodified lines# model_binder = DSM_ppi.from_pretrained("GleghornLab/DSM_650_ppi_lora").to(device).eval()# The lora version from the paper leads to unreliable outputs# Synthyra has generously trained a version through full fine tuningmodel = DSM.from_pretrained("Synthyra/DSM_ppi_full").to(device).eval()# BBF-14target_seq = "MGTPLWALLGGPWRGTATYEDGTKVTLDYRYTRVSPDRLRADVTYTTPDGTTLEATVDLWKDANGVIRYHATYPDGTSADGTLTQLDADTLLATGTYDDGTKYTVTLTRVAPGSGWHHHHHH"6 unmodified linesinput_tokens = tokenizer.encode(combined_input_str, add_special_tokens=True, return_tensors='pt').to(device)output = model.mask_diffusion_generate(tokenizer=tokenizer,input_tokens=input_tokens,step_divisor=100, # 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 time42 unmodified linesseqa, seqb = 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"SeqA: {seqa[0][5:]}") # remove cls tokenprint(f"SeqB: {seqb[0]}")```
README.md+25-20