Skip to main content

DrugCLIP: Multimodal Graph-Text Contrastive Learning for Drug Design 🧬✨

Python PyTorch RDKit

DrugCLIP is a deep-learning core package designed to perform contrastive alignment between 3D molecular structures and textual therapeutic/clinical descriptions. It powers AI drug discovery pipelines (like BioTarget) by scoring novel molecular geometries against clinical goals (binding affinity) and failure modes (toxicity).


🧩 Model Architecture

DrugCLIP maps text descriptions and 3D molecular point clouds into a shared 128-dimensional continuous latent space. It is designed to act as a surrogate multi-objective function, scoring binding potential and drug toxicity.

  • Graph Encoder: SchNet (3D Message Passing Neural Network), extracting features from atomic numbers (z) and 3D coordinates (pos).
  • Text Encoder: DistilBERT (distilbert-base-uncased), projecting clinical natural language queries into semantic embeddings.
  • Loss Function: InfoNCE (Contrastive Loss) matching paired batches of molecular geometries with their corresponding text records.

💾 Installation

To install DrugCLIP as a standalone pip package:

git clone https://github.com/your-org/drugclip.git
cd drugclip
pip install -e .

After installation, the CLI tool drugclip becomes globally available in your terminal.


📊 Dataset Preparation

DrugCLIP requires supervised data matching structures with clinical outcomes and textual descriptions. Out of the box, it supports preparing:

  1. MolTextNet (Structure-to-text mapping)
  2. TDC Tox21 (Experimental toxicity assays)
  3. TDC ClinTox (FDA clinical failure records)
  4. ChEMBL (Unlabeled chemical lookup libraries)

To download all datasets directly into data/:

drugclip data download all

⚡ High-Performance Pre-Training

DrugCLIP is optimized for HPC and single-node multi-GPU setups. The PyTorch data-loaders utilize asynchronous pinning, and operations natively use Automatic Mixed Precision (AMP) via torch.amp.autocast. 3D molecular geometry is computed utilizing all available CPU cores via ProcessPoolExecutor before GPU encoding.

To train the contrastive alignment model:

# Full training run
drugclip train align

# Or validate your hardware limits with synthetic data
drugclip train align --quick-validate

Checkpoints are automatically saved to runs/align/best.ckpt relative to your execution path.


🔬 Standalone Inference

You can run isolated drug-retrieval inference directly through the DrugCLIP CLI:

drugclip infer --goal-text "A highly selective and safe kinase inhibitor" --top-n 5

Release files for drugclip 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drugclip 0.1.2
File Size Uploaded
drugclip-0.1.2.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drugclip 0.1.2
File Interpreter ABI Platform
drugclip-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 30.8 kB

Release files / drugclip-0.1.2.tar.gz

Download URL drugclip-0.1.2.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a78bf66aa6845d5f106179d0def3da84942d9925f04410b91b7aca6a22bfbc7
BLAKE2b-256 checksum
How to use checksums
422a9f8c1fee36d944aef3f71de8547dc3db074d084f7b55522a95f08c7ec56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / drugclip-0.1.2-py3-none-any.whl

Download URL drugclip-0.1.2-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7080cbbb25c06ac7db418c80fc36b45e5d7ca2d864644e4db277affaa4ecc597
BLAKE2b-256 checksum
How to use checksums
51ae147f49986c1bcd49b8e8fae76f9884b6d39d9892a792fbd9b24f4eb0e523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page