BiRNA-BERT is a BERT-style transformer encoder model that generates embeddings for RNA sequences. BiRNA-BERT has been trained on BPE tokens and individual nucleotides. As a result, it can generate both granular nucleotide-level embeddings and efficient sequence-level embeddings (using BPE).
import torch
import transformers
from transformers import AutoModelForMaskedLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("buetnlpbio/birna-tokenizer")
config = transformers.BertConfig.from_pretrained("buetnlpbio/birna-bert")
mysterybert = AutoModelForMaskedLM.from_pretrained("buetnlpbio/birna-bert",config=config,trust_remote_code=True)
mysterybert.cls = torch.nn.Identity()
# To get sequence embeddings
seq_embed = mysterybert(**tokenizer("AGCTACGTACGT", return_tensors="pt"))
print(seq_embed.logits.shape) # CLS + 4 BPE token embeddings + SEP# To get nucleotide embeddings
char_embed = mysterybert(**tokenizer("A G C T A C G T A C G T", return_tensors="pt"))
print(char_embed.logits.shape) # CLS + 12 nucleotide token embeddings + SEP
Explicitly increasing max sequence length
config = transformers.BertConfig.from_pretrained("buetnlpbio/birna-bert")
config.alibi_starting_size = 2048# maximum sequence length updated to 2048 from config default of 1024
mysterybert = AutoModelForMaskedLM.from_pretrained("buetnlpbio/birna-bert",config=config,trust_remote_code=True)
Runs of buetnlpbio birna-bert on huggingface.co
1.0K
Total runs
-1
24-hour runs
8
3-day runs
31
7-day runs
-19
30-day runs
More Information About birna-bert huggingface.co Model
birna-bert huggingface.co
birna-bert huggingface.co is an AI model on huggingface.co that provides birna-bert's model effect (), which can be used instantly with this buetnlpbio birna-bert model. huggingface.co supports a free trial of the birna-bert model, and also provides paid use of the birna-bert. Support call birna-bert model through api, including Node.js, Python, http.
birna-bert huggingface.co is an online trial and call api platform, which integrates birna-bert's modeling effects, including api services, and provides a free online trial of birna-bert, you can try birna-bert online for free by clicking the link below.
buetnlpbio birna-bert online free url in huggingface.co:
birna-bert is an open source model from GitHub that offers a free installation service, and any user can find birna-bert on GitHub to install. At the same time, huggingface.co provides the effect of birna-bert install, users can directly use birna-bert installed effect in huggingface.co for debugging and trial. It also supports api for free installation.