Update README.md
Browse files
README.md
CHANGED
|
@@ -9,7 +9,7 @@ tags:
|
|
| 9 |
|
| 10 |
# kuelumbus/polyBERT
|
| 11 |
|
| 12 |
-
This is
|
| 13 |
|
| 14 |
<!--- Describe your model here -->
|
| 15 |
|
|
@@ -25,10 +25,10 @@ Then you can use the model like this:
|
|
| 25 |
|
| 26 |
```python
|
| 27 |
from sentence_transformers import SentenceTransformer
|
| 28 |
-
|
| 29 |
|
| 30 |
model = SentenceTransformer('kuelumbus/polyBERT')
|
| 31 |
-
embeddings = model.encode(
|
| 32 |
print(embeddings)
|
| 33 |
```
|
| 34 |
|
|
@@ -50,35 +50,31 @@ def mean_pooling(model_output, attention_mask):
|
|
| 50 |
|
| 51 |
|
| 52 |
# Sentences we want sentence embeddings for
|
| 53 |
-
|
| 54 |
|
| 55 |
# Load model from HuggingFace Hub
|
| 56 |
tokenizer = AutoTokenizer.from_pretrained('kuelumbus/polyBERT')
|
| 57 |
model = AutoModel.from_pretrained('kuelumbus/polyBERT')
|
| 58 |
|
| 59 |
# Tokenize sentences
|
| 60 |
-
encoded_input = tokenizer(
|
| 61 |
|
| 62 |
# Compute token embeddings
|
| 63 |
with torch.no_grad():
|
| 64 |
model_output = model(**encoded_input)
|
| 65 |
|
| 66 |
# Perform pooling. In this case, mean pooling.
|
| 67 |
-
|
| 68 |
|
| 69 |
-
print("
|
| 70 |
-
print(
|
| 71 |
```
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
## Evaluation Results
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=kuelumbus/polyBERT)
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
## Full Model Architecture
|
| 84 |
```
|
|
@@ -90,4 +86,4 @@ SentenceTransformer(
|
|
| 90 |
|
| 91 |
## Citing & Authors
|
| 92 |
|
| 93 |
-
|
|
|
|
| 9 |
|
| 10 |
# kuelumbus/polyBERT
|
| 11 |
|
| 12 |
+
This is polyBERT: A chemical language model to enable fully machine-driven ultrafast polymer informatics. polyBERT maps PSMILES strings to 600 dimensional dense fingerprints. The fingerprints numerically represent polymer chemical structures.
|
| 13 |
|
| 14 |
<!--- Describe your model here -->
|
| 15 |
|
|
|
|
| 25 |
|
| 26 |
```python
|
| 27 |
from sentence_transformers import SentenceTransformer
|
| 28 |
+
psmiles_strings = ["[*]CC[*]", "[*]COC[*]"]
|
| 29 |
|
| 30 |
model = SentenceTransformer('kuelumbus/polyBERT')
|
| 31 |
+
embeddings = model.encode(psmiles_strings)
|
| 32 |
print(embeddings)
|
| 33 |
```
|
| 34 |
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
# Sentences we want sentence embeddings for
|
| 53 |
+
psmiles_strings = ["[*]CC[*]", "[*]COC[*]"]
|
| 54 |
|
| 55 |
# Load model from HuggingFace Hub
|
| 56 |
tokenizer = AutoTokenizer.from_pretrained('kuelumbus/polyBERT')
|
| 57 |
model = AutoModel.from_pretrained('kuelumbus/polyBERT')
|
| 58 |
|
| 59 |
# Tokenize sentences
|
| 60 |
+
encoded_input = tokenizer(psmiles_strings, padding=True, truncation=True, return_tensors='pt')
|
| 61 |
|
| 62 |
# Compute token embeddings
|
| 63 |
with torch.no_grad():
|
| 64 |
model_output = model(**encoded_input)
|
| 65 |
|
| 66 |
# Perform pooling. In this case, mean pooling.
|
| 67 |
+
fingerprints = mean_pooling(model_output, encoded_input['attention_mask'])
|
| 68 |
|
| 69 |
+
print("Fingerprints:")
|
| 70 |
+
print(fingerprints)
|
| 71 |
```
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
## Evaluation Results
|
| 76 |
|
| 77 |
+
See https://github.com/Ramprasad-Group/polyBERT
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
## Full Model Architecture
|
| 80 |
```
|
|
|
|
| 86 |
|
| 87 |
## Citing & Authors
|
| 88 |
|
| 89 |
+
t.b.d.
|