The MultiMolecule team is aware of a potential risk in reproducing the results of ncRNABert.
The ncRNABert apply
softmax
in the
-2
dimension when computing the attention probs. This makes the output of
attention_probs @ value_layer
unreliable 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.
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 set
bos_token=None, eos_token=None
in the tokenizer and set
bos_token_id=None, eos_token_id=None
in the model configuration if you want the exact behavior of the original implementation.
The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
The team releasing ncRNABert did not write this model card for this model so this model card has been written by the MultiMolecule team.
Model Details
ncRNABert is a
bert
-style model pre-trained on a large corpus of 5’ untranslated regions (5’UTRs) in a self-supervised fashion. This means that the model was trained on the raw nucleotides of RNA sequences only, with an automatic process to generate inputs and labels from those texts. Please refer to the
Training Details
section for more information on the training process.
The model file depends on the
multimolecule
library. You can install it using pip:
pip install multimolecule
Direct Use
Masked Language Modeling
You can use this model directly with a pipeline for masked language modeling:
>>> import multimolecule # you must import multimolecule to register models>>> from transformers import pipeline
>>> unmasker = pipeline("fill-mask", model="multimolecule/ncrnabert")
>>> unmasker("gguc<mask>cucugguuagaccagaucugagccu")
[{'score': 0.19942431151866913,
'token': 2,
'token_str': '<eos>',
'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'},
{'score': 0.1465310901403427,
'token': 25,
'token_str': 'I',
'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'},
{'score': 0.1448192000389099,
'token': 23,
'token_str': '*',
'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'},
{'score': 0.14174020290374756,
'token': 3,
'token_str': '<unk>',
'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'},
{'score': 0.13194777071475983,
'token': 1,
'token_str': '<cls>',
'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'}]
Downstream Use
Extract Features
Here is how to use this model to get the features of a given sequence in PyTorch:
from multimolecule import RnaTokenizer, NcRnaBertModel
tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
model = NcRnaBertModel.from_pretrained("multimolecule/ncrnabert")
text = "UAGCUUAUCAGACUGAUGUUG"input = tokenizer(text, return_tensors="pt")
output = model(**input)
Sequence Classification / Regression
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.
Here is how to use this model as backbone to fine-tune for a sequence-level task in PyTorch:
import torch
from multimolecule import RnaTokenizer, NcRnaBertForSequencePrediction
tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
model = NcRnaBertForSequencePrediction.from_pretrained("multimolecule/ncrnabert")
text = "UAGCUUAUCAGACUGAUGUUG"input = tokenizer(text, return_tensors="pt")
label = torch.tensor([1])
output = model(**input, labels=label)
Token Classification / Regression
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.
Here is how to use this model as backbone to fine-tune for a nucleotide-level task in PyTorch:
import torch
from multimolecule import RnaTokenizer, NcRnaBertForTokenPrediction
tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
model = NcRnaBertForTokenPrediction.from_pretrained("multimolecule/ncrnabert")
text = "UAGCUUAUCAGACUGAUGUUG"input = tokenizer(text, return_tensors="pt")
label = torch.randint(2, (len(text), ))
output = model(**input, labels=label)
Contact Classification / Regression
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.
Here is how to use this model as backbone to fine-tune for a contact-level task in PyTorch:
import torch
from multimolecule import RnaTokenizer, NcRnaBertForContactPrediction
tokenizer = RnaTokenizer.from_pretrained("multimolecule/ncrnabert")
model = NcRnaBertForContactPrediction.from_pretrained("multimolecule/ncrnabert")
text = "UAGCUUAUCAGACUGAUGUUG"input = tokenizer(text, return_tensors="pt")
label = torch.randint(2, (len(text), len(text)))
output = model(**input, labels=label)
Training Details
ncRNABert used Masked Language Modeling (MLM) as the pre-training objective: taking a sequence, the model randomly masks 15% of the tokens in the input then runs the entire masked sentence through the model and has to predict the masked tokens. This is comparable to the Cloze task in language modeling.
Training Data
The ncRNABert model was pre-trained on
RNAcentral
.
RNAcentral is a free, public resource that offers integrated access to a comprehensive and up-to-date set of non-coding RNA sequences provided by a collaborating group of
Expert Databases
representing a broad range of organisms and RNA types.
Training Procedure
Preprocessing
ncRNABert used masked language modeling (MLM) as one of the pre-training objectives. The masking procedure is similar to the one used in BERT:
15% of the tokens are masked.
In 80% of the cases, the masked tokens are replaced by
<mask>
.
In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
In the 10% remaining cases, the masked tokens are left as is.
Contact
Please use GitHub issues of
MultiMolecule
for any questions or comments on the model card.
ncrnabert huggingface.co is an AI model on huggingface.co that provides ncrnabert's model effect (), which can be used instantly with this multimolecule ncrnabert model. huggingface.co supports a free trial of the ncrnabert model, and also provides paid use of the ncrnabert. Support call ncrnabert model through api, including Node.js, Python, http.
ncrnabert huggingface.co is an online trial and call api platform, which integrates ncrnabert's modeling effects, including api services, and provides a free online trial of ncrnabert, you can try ncrnabert online for free by clicking the link below.
multimolecule ncrnabert online free url in huggingface.co:
ncrnabert is an open source model from GitHub that offers a free installation service, and any user can find ncrnabert on GitHub to install. At the same time, huggingface.co provides the effect of ncrnabert install, users can directly use ncrnabert installed effect in huggingface.co for debugging and trial. It also supports api for free installation.