Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hers22/THGD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THGD: Topology-Aware Hierarchical Graph Diffusion Model

This implementation is based on DiGress's excellent work.

Environment Setup

The code has been tested with:

  • PyTorch 2.2
  • CUDA 11.8
  • PyTorch Geometric 2.3.1
conda create -n THGD python=3.10 -y
pip install torch==2.2 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
pip install torch-scatter==2.1.2
pip install -e .

Running the Code

All executions are launched via python3 main.py. Refer to Hydra documentation for parameter customization.

Training

The model training consists of two sequential phases:

  1. Coarse Model Training (learns high-level molecular topologies)
  2. Refinement Model Training (recovers atomic-level details)

Pre-configured training files are provided in configs/. Example for GuacaMol:

  1. Train coarse model:
cd src
python main.py +guacamol_exp=coarse
  1. Train refinement model:
python main.py +guacamol_exp=refine

Notes:

Sampling

Sampling requires:

  1. Trained coarse model checkpoint
  2. Trained refinement model checkpoint
  3. Precomputed optimal prior distribution tensor (obtain by preprocessing)

De Novo Generation

Use pre-configured sampling profiles:

python sample.py sample=guacamol

Configuration Alignment:
Ensure the checkpoint's training config matches your sampling config (e.g., coarse_cfg in YAML must correspond to the checkpoint's original training config).

Scaffold-Constrained Generation

Modify the scaffold field in the sampling config.

Pre-trained Checkpoints

Available checkpoint for three datasets (place downloaded files and place in checkpoints/ folder):

https://drive.google.com/file/d/1nOrOq6Jf7adqG0vbitnbFPJ9_-AzdHcX/view?usp=sharing

Dataset Coarse Model (NLL) Refinement Model (NLL)
ZINC250k 44.9 82.9
MOSES 37.5 72.0
GuacaMol 59.8 94.6

Generated Samples

We provide few example outputs in sample-results/.

About

"Topology-Aware Hierarchical Graph Diffusion Model" from ECML-PKDD 25

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published