Upload folder using huggingface_hub
Browse files- README.md +112 -0
- msgat_model.pt +3 -0
- norm_stats.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- graph-neural-network
|
| 5 |
+
- molecular-property-prediction
|
| 6 |
+
- quantum-chemistry
|
| 7 |
+
- cheminformatics
|
| 8 |
+
- pytorch
|
| 9 |
+
- SMILES
|
| 10 |
+
- attention-mechanism
|
| 11 |
+
- GNN
|
| 12 |
+
license: mit
|
| 13 |
+
library_name: pytorch
|
| 14 |
+
datasets:
|
| 15 |
+
- QuantumChem/QuantumChem_200k
|
| 16 |
+
metrics:
|
| 17 |
+
- mae
|
| 18 |
+
- r2
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# MSGAT: Multi-Scale Graph Attention Network
|
| 22 |
+
|
| 23 |
+
A lightweight graph neural network (**242K parameters**) for predicting 10 quantum-chemical properties from molecular SMILES strings.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
- **Architecture**: Edge-aware multi-head attention + MPNN + cross-scale fusion
|
| 28 |
+
- **Parameters**: 242,407
|
| 29 |
+
- **Hidden dim**: 64, 4 attention heads, 3 layers
|
| 30 |
+
- **Node features**: 58-dim (atomic number, degree, charge, Hs, hybridization, aromaticity)
|
| 31 |
+
- **Bond features**: 12-dim (bond type, conjugation, ring, stereo)
|
| 32 |
+
- **Training data**: [QuantumChem/QuantumChem_200k](https://huggingface.co/datasets/QuantumChem/QuantumChem_200k)
|
| 33 |
+
|
| 34 |
+
## Properties Predicted
|
| 35 |
+
|
| 36 |
+
| Property | Unit | MAE | R² |
|
| 37 |
+
|---|---|---|---|
|
| 38 |
+
| Sigma at 780 nm | GM | 10.10 | 0.953 |
|
| 39 |
+
| Max sigma | GM | 10.19 | 0.957 |
|
| 40 |
+
| ISC energy | eV | 0.0055 | 0.933 |
|
| 41 |
+
| Toxicity score | — | 0.017 | 0.924 |
|
| 42 |
+
| SA score | — | 0.0069 | 0.967 |
|
| 43 |
+
| Boiling point | °C | 5.77 | 0.984 |
|
| 44 |
+
| logP | — | 0.057 | 0.993 |
|
| 45 |
+
| Aromaticity | — | 0.0077 | 0.998 |
|
| 46 |
+
| Solubility | ug/ml | 71,953 | 0.053 |
|
| 47 |
+
| Molecular weight | g/mol | 1.61 | 0.806 |
|
| 48 |
+
|
| 49 |
+
Mean R² across 9/10 properties (excl. solubility): **0.946**
|
| 50 |
+
|
| 51 |
+
## Usage
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import torch
|
| 55 |
+
import torch.nn as nn
|
| 56 |
+
|
| 57 |
+
# Load the model
|
| 58 |
+
model_state = torch.load("msgat_model.pt", weights_index=None)
|
| 59 |
+
norm_stats = torch.load("norm_stats.pt")
|
| 60 |
+
|
| 61 |
+
# Reconstruct model architecture (see model.py in the repo)
|
| 62 |
+
from model import create_model # clone https://github.com/devansh0703/MSGAT
|
| 63 |
+
model = create_model()
|
| 64 |
+
model.load_state_dict(model_state)
|
| 65 |
+
model.eval()
|
| 66 |
+
|
| 67 |
+
# mean/std for inverse transform (shape: [10])
|
| 68 |
+
mean = norm_stats["mean"]
|
| 69 |
+
std = norm_stats["std"]
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Inverse normalization
|
| 73 |
+
|
| 74 |
+
The model outputs z-score normalized predictions. To get raw values:
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
# solubility uses log1p before normalization — must invert with expm1
|
| 78 |
+
raw = preds * std + mean
|
| 79 |
+
sol_idx = 8 # solubility index in active props
|
| 80 |
+
raw[:, sol_idx] = torch.expm1(raw[:, sol_idx])
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Files
|
| 84 |
+
|
| 85 |
+
| File | Description |
|
| 86 |
+
|---|---|
|
| 87 |
+
| `msgat_model.pt` | Trained model state dict (242K params) |
|
| 88 |
+
| `norm_stats.pt` | Z-score normalization stats (mean, std) for the 10 active properties |
|
| 89 |
+
|
| 90 |
+
## Training
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
git clone https://github.com/devansh0703/MSGAT
|
| 94 |
+
cd MSGAT
|
| 95 |
+
pip install torch rdkit-pypi datasets pandas tqdm matplotlib
|
| 96 |
+
python train.py # train/val split
|
| 97 |
+
python train_final.py # full data retrain
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
## Citation
|
| 101 |
+
|
| 102 |
+
```bibtex
|
| 103 |
+
@article{raulo2025msgat,
|
| 104 |
+
title={MSGAT: Multi-Scale Graph Attention Network for Efficient Molecular Property Prediction},
|
| 105 |
+
author={Raulo, Devansh},
|
| 106 |
+
year={2025}
|
| 107 |
+
}
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
## Acknowledgements
|
| 111 |
+
|
| 112 |
+
Dataset: [QuantumChem/QuantumChem_200k](https://huggingface.co/datasets/QuantumChem/QuantumChem_200k) by Zeng et al.
|
msgat_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc76003a002ae456fdfce5856df54dc61a0eb44e9986486635a01803ac282b6f
|
| 3 |
+
size 1013579
|
norm_stats.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa210b86fb721cdbd59577afd523ed826eae2bdc070aaf1119c1c43e85fadea5
|
| 3 |
+
size 1853
|