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.
Create a new conda environment:
conda create -n rxnclf python=3.11
conda activate rxnclfInstall 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.htmlInstall 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-geometricInstall Chemprop and other dependencies:
pip install chemprop==2.2.2
pip install PyYAML tensorboardInstall 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)"Mixed precision training requires NVIDIA Apex.
Please follow the installation instructions from the Apex repository:
https://github.com/NVIDIA/apex
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.
The fine-tuning benchmarks used in the manuscript include:
- Buchwald–Hartwig dataset
- Pd-catalyzed BH coupling (CN)
Relevant publications:
Configuration options are described in:
config.yaml
Run:
python rxnclf.pyConfiguration options are described in:
config_finetune.yaml
Run:
python finetune.pyGenerate RxnCLF embeddings:
python space.pyThis script generates the embedding files required for latent space analysis.
To reproduce the latent space visualization:
- Generate embeddings using:
python space.py- Launch:
space_analysis.ipynb
If additional input files are required, please place them in the locations specified in the notebook.
See:
LICENSES_THIRD_PARTY
for third-party software license information.
- SimCLR implementation: https://github.com/sthalles/SimCLR
- Strategies for Pre-training Graph Neural Networks: https://github.com/snap-stanford/pretrain-gnns