Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,99 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
# Model Card for
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
-
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
|
| 40 |
### Direct Use
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
#### Training Hyperparameters
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
|
| 121 |
-
####
|
| 122 |
|
| 123 |
-
|
|
|
|
| 124 |
|
| 125 |
-
|
|
|
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- chemistry
|
| 5 |
+
- molecule
|
| 6 |
+
license: mit
|
| 7 |
---
|
| 8 |
|
| 9 |
+
# Model Card for Roberta Zinc Compression Encoder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
### Model Description
|
| 12 |
|
| 13 |
+
`roberta_zinc_compression_encoder` contains several MLP-style compression heads trained to compress
|
| 14 |
+
molecule embeddings from the [roberta_zinc_480m](https://huggingface.co/entropy/roberta_zinc_480m)
|
| 15 |
+
from the native dimension of 768 to smaller dimensions - 512, 256, 128, 64, 32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
- **Developed by:** Karl Heyer
|
| 18 |
+
- **License:** MIT
|
| 19 |
|
|
|
|
| 20 |
|
| 21 |
### Direct Use
|
| 22 |
|
| 23 |
+
Usage examples. Note that input SMILES strings should be canonicalized.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
```python
|
| 26 |
+
from sentence_transformers import models, SentenceTransformer
|
| 27 |
+
from transformers import AutoModel
|
| 28 |
|
| 29 |
+
transformer = models.Transformer("entropy/roberta_zinc_480m",
|
| 30 |
+
max_seq_length=256,
|
| 31 |
+
model_args={"add_pooling_layer": False})
|
| 32 |
|
| 33 |
+
pooling = models.Pooling(transformer.get_word_embedding_dimension(),
|
| 34 |
+
pooling_mode="mean")
|
| 35 |
|
| 36 |
+
roberta_zinc = SentenceTransformer(modules=[transformer, pooling])
|
| 37 |
|
| 38 |
+
compression_encoder = AutoModel.from_pretrained("entropy/roberta_zinc_compression_encoder",
|
| 39 |
+
trust_remote_code=True)
|
| 40 |
+
# smiles should be canonicalized
|
| 41 |
+
smiles = [
|
| 42 |
+
"Brc1cc2c(NCc3ccccc3)ncnc2s1",
|
| 43 |
+
"Brc1cc2c(NCc3ccccn3)ncnc2s1",
|
| 44 |
+
"Brc1cc2c(NCc3cccs3)ncnc2s1",
|
| 45 |
+
"Brc1cc2c(NCc3ccncc3)ncnc2s1",
|
| 46 |
+
"Brc1cc2c(Nc3ccccc3)ncnc2s1",
|
| 47 |
+
]
|
| 48 |
|
| 49 |
+
embeddings = roberta_zinc.encode(smiles, convert_to_tensor=True)
|
| 50 |
+
print(embeddings.shape)
|
| 51 |
+
# torch.Size([6, 768])
|
| 52 |
|
| 53 |
+
compressed_embeddings = compression_encoder.compress(embeddings.cpu(),
|
| 54 |
+
compression_sizes=[32, 64, 128, 256, 512])
|
| 55 |
|
| 56 |
+
for k,v in compressed_embeddings.items():
|
| 57 |
+
print(k, v.shape)
|
| 58 |
|
| 59 |
+
# 32 torch.Size([6, 32])
|
| 60 |
+
# 64 torch.Size([6, 64])
|
| 61 |
+
# 128 torch.Size([6, 128])
|
| 62 |
+
# 256 torch.Size([6, 256])
|
| 63 |
+
# 512 torch.Size([6, 512])
|
| 64 |
+
```
|
|
|
|
| 65 |
|
| 66 |
### Training Procedure
|
| 67 |
|
| 68 |
+
#### Preprocessing
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
A dataset of 30m SMILES strings were assembled from the [ZINC Database](https://zinc.docking.org/)
|
| 71 |
+
and the [Enamine](https://enamine.net/) real space. SMILES were canonicalized and embedded with the
|
| 72 |
+
[roberta_zinc_480m](https://huggingface.co/entropy/roberta_zinc_480m) model.
|
| 73 |
|
| 74 |
#### Training Hyperparameters
|
| 75 |
|
| 76 |
+
The model was trained for 1 epoch with a learning rate of 1e-3, cosine scheduling, weight decay of 0.01
|
| 77 |
+
and 10% warmup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
#### Training Loss
|
| 80 |
|
| 81 |
+
For training, the input batch of embeddings is compressed with all compression sizes via
|
| 82 |
+
the encoder layers, the reconstructed via the decoder layers.
|
| 83 |
|
| 84 |
+
For the encoder, we compute the pairwise similarities of the compressed embeddings and
|
| 85 |
+
compare to the pairwise similarities of the input embeddings using row-wise pearson correlation.
|
| 86 |
|
| 87 |
+
For the decoder, we compute the cosine similarity of the reconstructed embeddings to the inputs.
|
| 88 |
|
| 89 |
+
## Model Card Authors
|
| 90 |
|
| 91 |
+
Karl Heyer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
## Model Card Contact
|
| 94 |
|
| 95 |
+
karl@darmatterai.xyz
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
license: mit
|
| 99 |
+
---
|