Downloads · 30 days
32
20% of all-time downloads
multimolecule/ncrnabert
ncrnabert is a fill-mask model from multimolecule. Use it when you need the model to fill a missing word. It is set up for multimolecule. The card lists the license as agpl-3.0.
Pre-trained model on non-coding RNA (ncRNA) using a masked language modeling (MLM) objective.
Downloads · 30 days
32
20% of all-time downloads
All-time downloads
163
Public
Parameters
303M
2.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin1.2 GB · 50%
From the Hugging Face model README
Pre-trained model on non-coding RNA (ncRNA) using a masked language modeling (MLM) objective.
This is an UNOFFICIAL implementation of the A 5’ UTR Language Model for Decoding Untranslated Regions of mRNA and Function Predictions by Yanyi Chu, Dan Yu, et al.
The OFFICIAL repository of ncRNABert is at wangleiofficial/ncRNABert.
[!WARNING] The MultiMolecule team is aware of a potential risk in reproducing the results of ncRNABert.
The ncRNABert apply
softmaxin 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 set
bos_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.
The team releasing ncRNABert did not write this model card for this model so this model card has been written by the MultiMolecule team.
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
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'}]
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)
[!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.
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)
[!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.
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)
[!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.
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)
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.
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.
ncRNABert used masked language modeling (MLM) as one of the pre-training objectives. The masking procedure is similar to the one used in BERT:
<mask>.Please use GitHub issues of MultiMolecule for any questions or comments on the model card.
This model is licensed under the AGPL-3.0 License.
SPDX-License-Identifier: AGPL-3.0-or-later