Update README.md
Browse files
README.md
CHANGED
|
@@ -30,4 +30,82 @@ configs:
|
|
| 30 |
path: data/valid-*
|
| 31 |
- split: test
|
| 32 |
path: data/test-*
|
|
|
|
|
|
|
| 33 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
path: data/valid-*
|
| 31 |
- split: test
|
| 32 |
path: data/test-*
|
| 33 |
+
size_categories:
|
| 34 |
+
- 1B<n<10B
|
| 35 |
---
|
| 36 |
+
# ZINC_22 Pretraining Dataset
|
| 37 |
+
|
| 38 |
+
## Dataset Description
|
| 39 |
+
This dataset is derived from the **ZINC-22** database (~70B synthesizable compounds as of Sept 2024) and was prepared for large-scale pretraining of molecular language models. We randomly sampled **1.5 billion molecules** using a **stratified heavy-atom count split** (4–49 atoms) to ensure coverage of diverse chemical sizes.
|
| 40 |
+
All molecules were **deduplicated** to remove repeats, **canonicalized** in SMILES format, and **converted** into multiple string representations: SMILES, SELFIES, SAFE, DeepSMILES.
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## Precomputed Statistics
|
| 45 |
+
This repository includes precomputed reference statistics (`*_stats.pkl`) for evaluating generated molecules against validation and test sets.
|
| 46 |
+
These statistics are used to compute the following metrics:
|
| 47 |
+
|
| 48 |
+
- **FCD** – Fréchet ChemNet Distance
|
| 49 |
+
- **SNN** – Similarity to Nearest Neighbor
|
| 50 |
+
- **Frag** – Fragment similarity (BRICS decomposition)
|
| 51 |
+
- **Scaf** – Scaffold similarity (Bemis–Murcko scaffolds)
|
| 52 |
+
|
| 53 |
+
### File Naming Convention
|
| 54 |
+
Files are provided for multiple reference set sizes:
|
| 55 |
+
- `_175k` → 175,000 molecules
|
| 56 |
+
- `_500k` → 500,000 molecules
|
| 57 |
+
- `_1M` → 1 million molecules
|
| 58 |
+
- `_3M` → 3 million molecules
|
| 59 |
+
- *(no suffix)* → full set
|
| 60 |
+
|
| 61 |
+
By convention:
|
| 62 |
+
- `valid_stats_*` → computed from the **random validation split**
|
| 63 |
+
- `test_stats_*` → computed from the **scaffold-based split**
|
| 64 |
+
|
| 65 |
+
These statistics enable **consistent and reproducible** evaluation across experiments.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## How to Use
|
| 70 |
+
|
| 71 |
+
Before running the example below, make sure you have these packages installed:
|
| 72 |
+
```bash
|
| 73 |
+
pip install rdkit fcd-torch
|
| 74 |
+
```
|
| 75 |
+
### Example: Download stats from the Hub and compute FCD
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from huggingface_hub import hf_hub_download
|
| 79 |
+
import pickle
|
| 80 |
+
from fcd_torch import FCD as FCDMetric
|
| 81 |
+
|
| 82 |
+
# 1. Download the precomputed stats file from Hugging Face Hub
|
| 83 |
+
stats_path = hf_hub_download(
|
| 84 |
+
repo_id="chandar-lab/ZINC_22",
|
| 85 |
+
repo_type="dataset",
|
| 86 |
+
filename="valid_stats_175k.pkl" # change to desired file
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# 2. Load the reference stats
|
| 90 |
+
with open(stats_path, "rb") as f:
|
| 91 |
+
reference_stats = pickle.load(f)
|
| 92 |
+
|
| 93 |
+
# 3. Compute FCD for your generated molecules
|
| 94 |
+
generated_smiles = ["CCO", "CCN", "CCCN", "CCCN"] # replace with your generated set
|
| 95 |
+
fcd_calculator = FCDMetric(batch_size=4)
|
| 96 |
+
|
| 97 |
+
fcd_value = fcd_calculator(gen=generated_smiles, pref=reference_stats["FCD"])
|
| 98 |
+
print(f"FCD score: {fcd_value:.4f}")
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Citation
|
| 102 |
+
|
| 103 |
+
```bibtex
|
| 104 |
+
@article{chitsaz2024novomolgen,
|
| 105 |
+
title={NovoMolGen: Rethinking Molecular Language Model Pretraining},
|
| 106 |
+
author={Chitsaz, Kamran and Balaji, Roshan and Fournier, Quentin and
|
| 107 |
+
Bhatt, Nirav Pravinbhai and Chandar, Sarath},
|
| 108 |
+
journal={arXiv preprint},
|
| 109 |
+
year={2025},
|
| 110 |
+
}
|
| 111 |
+
```
|