Views
No views yet
[!TIP] The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
| Variants | Num Layers | Hidden Size | Num Heads | Intermediate Size | Num Parameters (M) | FLOPs (G) | MACs (G) | Max Num Tokens |
|---|---|---|---|---|---|---|---|---|
| 3UTRBERT-6mer | 12 | 768 | 12 | 3072 | 98.05 | 96.86 | 48.32 | 512 |
| 3UTRBERT-5mer | 88.45 | |||||||
| 3UTRBERT-4mer | 86.53 | |||||||
| 3UTRBERT-3mer | 86.14 |
multimolecule library. You can install it using pip:pip install multimolecule[!WARNING] Default transformers pipeline does not support K-mer tokenization.
1import multimolecule # you must import multimolecule to register models
2from transformers import pipeline
3
4predictor = pipeline("fill-mask", model="multimolecule/utrbert-3mer")
5output = predictor("gguc<mask><mask><mask>cugguuagaccagaucugagccu")[1]1from multimolecule import RnaTokenizer, UtrBertModel
2
3
4tokenizer = RnaTokenizer.from_pretrained("multimolecule/utrbert-3mer")
5model = UtrBertModel.from_pretrained("multimolecule/utrbert-3mer")
6
7text = "UAGCUUAUCAGACUGAUGUUG"
8input = tokenizer(text, return_tensors="pt")
9
10output = model(**input)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for sequence classification or regression.
1import torch
2from multimolecule import RnaTokenizer, UtrBertForSequencePrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/utrbert-3mer")
6model = UtrBertForSequencePrediction.from_pretrained("multimolecule/utrbert-3mer")
7
8text = "UAGCUUAUCAGACUGAUGUUG"
9input = tokenizer(text, return_tensors="pt")
10label = torch.tensor([1])
11
12output = model(**input, labels=label)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for token classification or regression.
1import torch
2from multimolecule import RnaTokenizer, UtrBertForTokenPrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/utrbert-3mer")
6model = UtrBertForTokenPrediction.from_pretrained("multimolecule/utrbert-3mer")
7
8text = "UAGCUUAUCAGACUGAUGUUG"
9input = tokenizer(text, return_tensors="pt")
10label = torch.randint(2, (len(text), ))
11
12output = model(**input, labels=label)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for contact classification or regression.
1import torch
2from multimolecule import RnaTokenizer, UtrBertForContactPrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/utrbert-3mer")
6model = UtrBertForContactPrediction.from_pretrained("multimolecule/utrbert-3mer")
7
8text = "UAGCUUAUCAGACUGAUGUUG"
9input = tokenizer(text, return_tensors="pt")
10label = torch.randint(2, (len(text), len(text)))
11
12output = model(**input, labels=label)RnaTokenizer][multimolecule.RnaTokenizer] will convert "T"s to "U"s for you, you may disable this behaviour by passing replace_T_with_U=False.<mask> for 80% of masked tokens"UAGCGUAU" will be tokenized as ["UAG", "AGC", "GCG", "CGU", "GUA", "UAU"]. If the nucleotide "C" is masked, the adjacent tokens will also be masked, resulting ["UAG", "<mask>", "<mask>", "<mask>", "GUA", "UAU"].1@article {yang2023deciphering,
2 author = {Yang, Yuning and Li, Gen and Pang, Kuan and Cao, Wuxinhao and Li, Xiangtao and Zhang, Zhaolei},
3 title = {Deciphering 3{\textquoteright} UTR mediated gene regulation using interpretable deep representation learning},
4 elocation-id = {2023.09.08.556883},
5 year = {2023},
6 doi = {10.1101/2023.09.08.556883},
7 publisher = {Cold Spring Harbor Laboratory},
8 abstract = {The 3{\textquoteright}untranslated regions (3{\textquoteright}UTRs) of messenger RNAs contain many important cis-regulatory elements that are under functional and evolutionary constraints. We hypothesize that these constraints are similar to grammars and syntaxes in human languages and can be modeled by advanced natural language models such as Transformers, which has been very effective in modeling protein sequence and structures. Here we describe 3UTRBERT, which implements an attention-based language model, i.e., Bidirectional Encoder Representations from Transformers (BERT). 3UTRBERT was pre-trained on aggregated 3{\textquoteright}UTR sequences of human mRNAs in a task-agnostic manner; the pre-trained model was then fine-tuned for specific downstream tasks such as predicting RBP binding sites, m6A RNA modification sites, and predicting RNA sub-cellular localizations. Benchmark results showed that 3UTRBERT generally outperformed other contemporary methods in each of these tasks. We also showed that the self-attention mechanism within 3UTRBERT allows direct visualization of the semantic relationship between sequence elements.Competing Interest StatementThe authors have declared no competing interest.},
9 URL = {https://www.biorxiv.org/content/early/2023/09/12/2023.09.08.556883},
10 eprint = {https://www.biorxiv.org/content/early/2023/09/12/2023.09.08.556883.full.pdf},
11 journal = {bioRxiv}
12}[!NOTE] The artifacts distributed in this repository are part of the MultiMolecule project. If MultiMolecule supports your research, please cite the MultiMolecule project as follows:
1@software{chen_2024_12638419,
2 author = {Chen, Zhiyuan and Zhu, Sophia Y.},
3 title = {MultiMolecule},
4 doi = {10.5281/zenodo.12638419},
5 publisher = {Zenodo},
6 url = {https://doi.org/10.5281/zenodo.12638419},
7 year = 2024,
8 month = may,
9 day = 4
10}SPDX-License-Identifier: AGPL-3.0-or-later