Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
Load the model:
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
import torch
|
| 11 |
+
from transformers import AutoModel, AutoTokenizer
|
| 12 |
+
|
| 13 |
+
model_name = "rnalm/144M_H_MLM_best"
|
| 14 |
+
|
| 15 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 16 |
+
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
|
| 17 |
+
|
| 18 |
+
# Move model to GPU
|
| 19 |
+
model = model.cuda()
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
Get embeddings:
|
| 23 |
+
```
|
| 24 |
+
inputs = tokenizer("ACGTACGT", return_tensors="pt")
|
| 25 |
+
|
| 26 |
+
with torch.no_grad():
|
| 27 |
+
outputs = model(input_ids=inputs["input_ids"].cuda())
|
| 28 |
+
|
| 29 |
+
outputs.last_hidden_state.shape
|
| 30 |
+
# torch.Size([1, 8, 768])
|
| 31 |
+
|
| 32 |
+
outputs.seq_logits.shape
|
| 33 |
+
# torch.Size([1, 8, 11])
|
| 34 |
+
```
|