Skip to content

Repository files navigation

RxnCLF

Tested Environment

This repository has been tested on:

  • Linux
  • Python 3.11
  • CUDA 11.8
  • PyTorch 2.1.0

The code has not been tested on macOS or Windows. A CUDA-compatible GPU is recommended for pretraining and fine-tuning.


Installation

Create a new conda environment:

conda create -n rxnclf python=3.11
conda activate rxnclf

Install PyTorch:

pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0+cu118 \
    -f https://download.pytorch.org/whl/torch_stable.html

Install PyTorch Geometric dependencies:

pip install --no-build-isolation torch-scatter \
    -f https://data.pyg.org/whl/torch-2.1.2+cu118.html

pip install --no-build-isolation torch-sparse \
    -f https://data.pyg.org/whl/torch-2.1.2+cu118.html

pip install --no-build-isolation torch-cluster \
    -f https://data.pyg.org/whl/torch-2.1.2+cu118.html

pip install --no-build-isolation torch-spline-conv \
    -f https://data.pyg.org/whl/torch-2.1.2+cu118.html

pip install torch-geometric

Install Chemprop and other dependencies:

pip install chemprop==2.2.2
pip install PyYAML tensorboard

Install a NumPy version compatible with Chemprop:

pip uninstall numpy -y
pip install "numpy<2"

Verify installation:

python -c "import numpy; import torch; x=torch.from_numpy(numpy.array([1,2,3])); print(x)"

Optional dependency

Mixed precision training requires NVIDIA Apex.

Please follow the installation instructions from the Apex repository:

https://github.com/NVIDIA/apex


Dataset

Pre-training dataset

RxnCLF pretraining requires the Pistachio reaction dataset.

The Pistachio dataset is not distributed with this repository and must be obtained separately.

After downloading the dataset, update the dataset path in:

config.yaml

before running pretraining.

Fine-tuning benchmarks

The fine-tuning benchmarks used in the manuscript include:

  • Buchwald–Hartwig dataset
  • Pd-catalyzed BH coupling (CN)

Relevant publications:


Pre-training

Configuration options are described in:

config.yaml

Run:

python rxnclf.py

Fine-tuning

Configuration options are described in:

config_finetune.yaml

Run:

python finetune.py

Embedding Generation

Generate RxnCLF embeddings:

python space.py

This script generates the embedding files required for latent space analysis.


Latent Space Analysis

To reproduce the latent space visualization:

  1. Generate embeddings using:
python space.py
  1. Launch:
space_analysis.ipynb

If additional input files are required, please place them in the locations specified in the notebook.


Third-Party Licenses

See:

LICENSES_THIRD_PARTY

for third-party software license information.


Acknowledgements


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages