Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -3,8 +3,9 @@
|
|
3 |
tags:
|
4 |
- LoRA
|
5 |
- protein language model
|
|
|
6 |
datasets:
|
7 |
-
- SoftDis
|
8 |
---
|
9 |
|
10 |
# LoRA-DR-suite
|
@@ -70,21 +71,24 @@ import torch.nn.functional as F
|
|
70 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
71 |
model = model.to(device)
|
72 |
|
73 |
-
# example sequence
|
74 |
-
sequence = "
|
75 |
|
76 |
# each pre-trained model adds its own special tokens to the tokenized sequence,
|
77 |
-
# special_tokens_mask allows to deal with them (padding included, for batched
|
78 |
-
# without changing the code
|
79 |
-
inputs = tokenizer(
|
|
|
|
|
80 |
input_ids = inputs['input_ids'].to(device)
|
81 |
attention_mask = inputs['attention_mask'].to(device)
|
82 |
special_tokens_mask = inputs['special_tokens_mask'].bool()
|
83 |
|
84 |
# extract predicted disorder probability
|
85 |
with torch.inference_mode():
|
86 |
-
output = model(input_ids
|
87 |
-
|
|
|
88 |
```
|
89 |
|
90 |
## How to cite
|
|
|
3 |
tags:
|
4 |
- LoRA
|
5 |
- protein language model
|
6 |
+
base_model: facebook/esm2_t12_35M_UR50D
|
7 |
datasets:
|
8 |
+
- CQSB/SoftDis
|
9 |
---
|
10 |
|
11 |
# LoRA-DR-suite
|
|
|
71 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
72 |
model = model.to(device)
|
73 |
|
74 |
+
# example sequence
|
75 |
+
sequence = "TAIWEQHTVTLHRAPGFGFGIAISGGRDNPHFQSGETSIVISDVLKG"
|
76 |
|
77 |
# each pre-trained model adds its own special tokens to the tokenized sequence,
|
78 |
+
# special_tokens_mask allows to deal with them (padding included, for batched
|
79 |
+
# inputs) without changing the code
|
80 |
+
inputs = tokenizer(
|
81 |
+
[sequence], return_tensors="pt", return_special_tokens_mask=True
|
82 |
+
)
|
83 |
input_ids = inputs['input_ids'].to(device)
|
84 |
attention_mask = inputs['attention_mask'].to(device)
|
85 |
special_tokens_mask = inputs['special_tokens_mask'].bool()
|
86 |
|
87 |
# extract predicted disorder probability
|
88 |
with torch.inference_mode():
|
89 |
+
output = model(input_ids, attention_mask).logits.cpu()
|
90 |
+
output = output[~special_tokens_mask, :]
|
91 |
+
disorder_proba = F.softmax(output, dim=-1)[:, 1]
|
92 |
```
|
93 |
|
94 |
## How to cite
|