Go to file
2024-09-16 22:45:12 +02:00
asset init 2024-01-28 18:24:47 -05:00
configs update the nasbench data 2024-08-20 09:24:39 +02:00
data add_data 2024-01-29 19:50:23 -05:00
graph_dit try to get the original perf 2024-09-16 22:45:12 +02:00
.gitignore get git ignore from diffsize 2024-08-13 16:54:32 +02:00
README.md update README file 2024-09-15 00:01:47 +02:00
requirements.txt init_code 2024-01-29 19:49:14 -05:00

Graph Diffusion Transformer for Multi-Conditional Molecular Generation

Initial Setup

Please download NASBench201 dataset(NAS-Bench-201-v1_1-096897.pth) from https://drive.google.com/file/d/16Y0UwGisiouVRxW-W5hEtbxmcHw_0hF_/view

and put it in the /path/to/repo/graph_dit folder.

Running the code

start command:

python main.py --config-name=config.yaml \
model.ensure_connected=True \
dataset.task_name='nasbench201' \
dataset.guidance_target='regression'

This repository contains the code for the paper "Inverse Molecular Design with Multi-Conditional Diffusion Guidance" by Gang Liu, Jiaxin Xu, Tengfei Luo, and Meng Jiang.

Paper: https://arxiv.org/abs/2401.13858

Requirements

All dependencies are specified in the requirements.txt file.

This code was developed and tested with Python 3.9.16, PyTorch 2.0.0, and PyG 2.3.0, Pytorch-lightning 2.0.1.

For molecular generation evaluation, we should first install rdkit.

Then fcd_torch: pip install fcd_torch (https://github.com/insilicomedicine/fcd_torch).

And mini_moses package: pip install git+https://github.com/igor-krawczuk/mini-moses (https://github.com/igor-krawczuk/mini-moses),

Usage

We could train the model on an A6000 GPU card. Here is an example to running the code for polymer graphs:

python main.py --config-name=config.yaml \
                model.ensure_connected=True \
                dataset.task_name='O2-N2-CO2' \
                dataset.guidance_target='O2-N2-CO2'

All default configurations can be found in configs/config.yaml. In this example, we set model.ensure_connected=True to ensure that all generated components are retained during graph-to-molecule conversion (see paper Section 3.2).

Other examples for small molecule generation:

python main.py --config-name=config.yaml \
                dataset.task_name='bace_b' \
                dataset.guidance_target='Class'

python main.py --config-name=config.yaml \
                dataset.task_name='bbbp_b' \
                dataset.guidance_target='p_np'

python main.py --config-name=config.yaml \
                dataset.task_name='hiv_b' \
                dataset.guidance_target='HIV_active'

We could generate polymer graphs by conditioning on single gas permeability.


python main.py --config-name=config.yaml \
                dataset.task_name='O2' \
                dataset.guidance_target='O2'

python main.py --config-name=config.yaml \
                dataset.task_name='N2' \
                dataset.guidance_target='N2'

python main.py --config-name=config.yaml \
                dataset.task_name='CO2' \
                dataset.guidance_target='CO2'

Feel free to test the code on your own dataset!

Citation

If you find this repository useful, please cite our paper:

@misc{liu2024inverse,
      title={Inverse Molecular Design with Multi-Conditional Diffusion Guidance}, 
      author={Gang Liu and Jiaxin Xu and Tengfei Luo and Meng Jiang},
      year={2024},
      eprint={2401.13858},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}