Views
No views yet
[!WARNING] The MultiMolecule team is aware of a potential risk in reproducing the results of ncRNABert.The ncRNABert applysoftmaxin the-2dimension when computing the attention probs. This makes the output ofattention_probs @ value_layerunreliable when the input sequences are not of the same length (i.e., have padding tokens). MultiMolecule applied a workaround to ensure that the attention masks are applied correctly, but this may lead to different results compared to the original implementation.
[!CAUTION] The MultiMolecule team is aware of a potential risk in reproducing the results of RibonanzaNet.The original implementation of ncRNABert does not prepend<bos>(<cls>) and append<eos>tokens to the input sequence. This should not affect the performance of the model in most cases, but it can lead to unexpected behavior in some cases.Please setbos_token=None, eos_token=Nonein the tokenizer and setbos_token_id=None, eos_token_id=Nonein the model configuration if you want the exact behavior of the original implementation.
[!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 |
|---|---|---|---|---|---|---|---|---|
| ncRNABert | 24 | 1024 | 16 | 4096 | 303.31 | 78.96 | 39.46 | 512 |
| ncRNABert-3mer |
multimolecule library. You can install it using pip:pip install multimolecule1>>> import multimolecule # you must import multimolecule to register models
2>>> from transformers import pipeline
3
4>>> unmasker = pipeline("fill-mask", model="multimolecule/ncrnabert")
5>>> unmasker("gguc<mask>cucugguuagaccagaucugagccu")
6[{'score': 0.19942431151866913,
7 'token': 2,
8 'token_str': '<eos>',
9 'sequence': 'G G U C C U C U G G U U A G A C C A G A U C U G A G C C U'},
10 {'score': 0.1465310901403427,
11 'token': 25,
12 'token_str': 'I',
13 'sequence': 'G G U C I C U C U G G U U A G A C C A G A U C U G A G C C U'},
14 {'score': 0.1448192000389099,
15 'token': 23,
16 'token_str': '*',
17 'sequence': 'G G U C * C U C U G G U U A G A C C A G A U C U G A G C C U'},
18 {'score': 0.14174020290374756,
19 'token': 3,
20 'token_str': '<unk>',
21 'sequence': 'G G U C C U C U G G U U A G A C C A G A U C U G A G C C U'},
22 {'score': 0.13194777071475983,
23 'token': 1,
24 'token_str': '<cls>',
25 'sequence': 'G G U C C U C U G G U U A G A C C A G A U C U G A G C C U'}]1from multimolecule import RnaTokenizer, NcRnaBertModel
2
3
4tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
5model = NcRnaBertModel.from_pretrained("multimolecule/ncrnabert")
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, NcRnaBertForSequencePrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
6model = NcRnaBertForSequencePrediction.from_pretrained("multimolecule/ncrnabert")
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, NcRnaBertForTokenPrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
6model = NcRnaBertForTokenPrediction.from_pretrained("multimolecule/ncrnabert")
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, NcRnaBertForContactPrediction
3
4
5tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
6model = NcRnaBertForContactPrediction.from_pretrained("multimolecule/ncrnabert")
7
8text = "UAGCUUAUCAGACUGAUGUUG"
9input = tokenizer(text, return_tensors="pt")
10label = torch.randint(2, (len(text), len(text)))
11
12output = model(**input, labels=label)<mask>.SPDX-License-Identifier: AGPL-3.0-or-later