Commit
·
da62e33
1
Parent(s):
921b588
Add paper link to README
Browse files
README.md
CHANGED
@@ -14,6 +14,23 @@ metrics:
|
|
14 |
- rmse
|
15 |
---
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# Farm Molecular Representation Model
|
18 |
You can read more about the model in our [paper](https://arxiv.org/pdf/2410.02082) or [webpage](https://thaonguyen217.github.io/farm/).
|
19 |
|
|
|
14 |
- rmse
|
15 |
---
|
16 |
|
17 |
+
# Example usage
|
18 |
+
```
|
19 |
+
from transformers import BertForMaskedLM, PreTrainedTokenizerFast
|
20 |
+
|
21 |
+
# Load the tokenizer and model
|
22 |
+
tokenizer = PreTrainedTokenizerFast.from_pretrained('thaonguyen217/farm_molecular_representation')
|
23 |
+
model = BertForMaskedLM.from_pretrained('thaonguyen217/farm_molecular_representation')
|
24 |
+
|
25 |
+
# Example usage
|
26 |
+
input_text = "N_primary_amine N_secondary_amine c_6-6 1 n_6-6 n_6-6 c_6-6 c_6-6 2 c_6-6 c_6-6 c_6-6 c_6-6 c_6-6 1 2" # FG-enhanced representation of NNc1nncc2ccccc12
|
27 |
+
inputs = tokenizer(input_text, return_tensors='pt')
|
28 |
+
outputs = model(**inputs, output_hidden_states=True)
|
29 |
+
|
30 |
+
# Extract atom embeddings from last hidden states
|
31 |
+
last_hidden_states = outputs.hidden_states[-1][0] # last_hidden_states: (N, 768) with N is input length
|
32 |
+
```
|
33 |
+
|
34 |
# Farm Molecular Representation Model
|
35 |
You can read more about the model in our [paper](https://arxiv.org/pdf/2410.02082) or [webpage](https://thaonguyen217.github.io/farm/).
|
36 |
|