File size: 814 Bytes
f39c34e
 
 
10234c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---

license: apache-2.0
---

# RNAElectra

RNAElectra is a pretrained RNA language model for nucleotide-level sequence representation learning.

## Load model

```python

import torch

from transformers import AutoModel

from tokenizer import NucEL_Tokenizer



device = "cuda" if torch.cuda.is_available() else "cpu"



model = AutoModel.from_pretrained(

    "FreakingPotato/RNAElectra",

    trust_remote_code=True

).to(device)



tokenizer = NucEL_Tokenizer.from_pretrained(

    "FreakingPotato/RNAElectra",

    trust_remote_code=True

)



sequence = "AUGCAUGCAUGCAUGC"

inputs = tokenizer(sequence, return_tensors="pt")

inputs = {k: v.to(device) for k, v in inputs.items()}



with torch.no_grad():

    outputs = model(**inputs)



embeddings = outputs.last_hidden_state

print(embeddings.shape)