Views
No views yet
ibm/biomed.omics.bl.sm-ted-458m for protein solubility prediction (binary classification) based solely on the amino acid sequence.ibm/biomed.omics.bl.sm.ma-ted-458m requires installing https://github.com/BiomedSciAI/biomed-multi-alignmentpip install git+https://github.com/BiomedSciAI/biomed-multi-alignment.gitibm/biomed.omics.bl.sm.ma-ted-458m:1import os
2
3from fuse.data.tokenizers.modular_tokenizer.op import ModularTokenizerOp
4
5from mammal.examples.protein_solubility.task import ProteinSolubilityTask
6from mammal.keys import CLS_PRED, SCORES
7from mammal.model import Mammal
8
9# Load Model
10model = Mammal.from_pretrained("ibm/biomed.omics.bl.sm.ma-ted-458m.protein_solubility")
11model.eval()
12
13# Load Tokenizer
14tokenizer_op = ModularTokenizerOp.from_pretrained("ibm/biomed.omics.bl.sm.ma-ted-458m.protein_solubility")
15
16# protein_seq: FASTA sequence of a protein, input for the model to predict its solubility
17protein_seq = "NLMKRCTRGFRKLGKCTTLEEEKCKTLYPRGQCTCSDSKMNTHSCDCKSC"
18
19# convert to MAMMAL style
20sample_dict = {"protein_seq": protein_seq}
21sample_dict = ProteinSolubilityTask.data_preprocessing(
22 sample_dict=sample_dict,
23 protein_sequence_key="protein_seq",
24 tokenizer_op=tokenizer_op,
25 device=model.device,
26)
27
28# running in generate mode
29batch_dict = model.generate(
30 [sample_dict],
31 output_scores=True,
32 return_dict_in_generate=True,
33 max_new_tokens=5,
34)
35
36# Post-process the model's output
37ans = ProteinSolubilityTask.process_model_output(
38 tokenizer_op=tokenizer_op,
39 decoder_output=batch_dict[CLS_PRED][0],
40 decoder_output_scores=batch_dict[SCORES][0],
41)
42
43# Print prediction
44print(f"{ans=}")https://github.com/BiomedSciAI/biomed-multi-alignment@misc{shoshan2024mammalmolecularaligned,
title={MAMMAL -- Molecular Aligned Multi-Modal Architecture and Language},
author={Yoel Shoshan and Moshiko Raboh and Michal Ozery-Flato and Vadim Ratner and Alex Golts and Jeffrey K. Weber and Ella Barkan and Simona Rabinovici-Cohen and Sagi Polaczek and Ido Amos and Ben Shapira and Liam Hazan and Matan Ninio and Sivan Ravid and Michael M. Danziger and Joseph A. Morrone and Parthasarathy Suryanarayanan and Michal Rosen-Zvi and Efrat Hexter},
year={2024},
eprint={2410.22367},
archivePrefix={arXiv},
primaryClass={q-bio.QM},
url={https://arxiv.org/abs/2410.22367},
}