torchdrug · diff

git:20260611.1b8fae3 to v1.1

171 added, 389 removed. Audit A to A.

---
name: torchdrug
- description: PyTorch-native graph neural networks for molecules and proteins. Use when building custom GNN architectures for drug discovery, protein modeling, or knowledge graph reasoning. Best for custom model development, protein property prediction, retrosynthesis. For pre-trained models and diverse featurizers use deepchem; for benchmark datasets use pytdc.
+ description: Build and troubleshoot TorchDrug 0.2.1 workflows for molecular graphs, property prediction, self-supervised pretraining, molecule generation, retrosynthesis, protein representation learning, and knowledge graph reasoning. Use when code imports torchdrug or needs its datasets, models, tasks, or Engine.
license: Apache-2.0 license
- metadata: {"version": "1.0", "skill-author": "K-Dense Inc."}
+ compatibility: TorchDrug 0.2.1 requires Python 3.7-3.10 and supports PyTorch 1.8-2.0. Apple Silicon is CPU-only; MPS is unsupported.
+ allowed-tools: Read Write Edit Bash
+ metadata:
+ version: "1.1"
+ skill-author: K-Dense Inc.
---
# TorchDrug
- ## Overview
+ Use TorchDrug as a modular PyTorch graph-learning stack:
- TorchDrug is a comprehensive PyTorch-based machine learning toolbox for drug discovery and molecular science. Apply graph neural networks, pre-trained models, and task definitions to molecules, proteins, and biological knowledge graphs, including molecular property prediction, protein modeling, knowledge graph reasoning, molecular generation, retrosynthesis planning, with 40+ curated datasets and 20+ model architectures.
+ 1. load a `datasets.*` dataset,
+ 2. choose a `models.*` representation model,
+ 3. wrap it in a `tasks.*` objective,
+ 4. train and evaluate it with `core.Engine`.
- ## When to Use This Skill
+ The current official documentation and latest release are both **0.2.1**. Treat
+ newer Python or PyTorch combinations as unverified rather than silently assuming
+ compatibility.
- This skill should be used when working with:
+ ## Start with the version guard
- **Data Types:**
- - SMILES strings or molecular structures
- - Protein sequences or 3D structures (PDB files)
- - Chemical reactions and retrosynthesis
- - Biomedical knowledge graphs
- - Drug discovery datasets
+ Before generating or debugging code, inspect the environment:
- **Tasks:**
- - Predicting molecular properties (solubility, toxicity, activity)
- - Protein function or structure prediction
- - Drug-target binding prediction
- - Generating new molecular structures
- - Planning chemical synthesis routes
- - Link prediction in biomedical knowledge bases
- - Training graph neural networks on scientific data
+ ```bash
+ python --version
+ python -c "import torch; print(torch.__version__)"
+ python -c "import torchdrug; print(torchdrug.__version__)"
+ ```
- **Libraries and Integration:**
- - TorchDrug is the primary library
- - Often used with RDKit for cheminformatics
- - Compatible with PyTorch and PyTorch Lightning
- - Integrates with AlphaFold and ESM for proteins
+ The supported matrix for TorchDrug 0.2.1 is:
- ## Getting Started
+ - Python 3.7 through 3.10
+ - PyTorch 1.8 through 2.0
+ - Linux, Windows, or macOS
+ - Apple Silicon: PyTorch 1.13 or later, CPU only; no MPS support
- ### Installation
+ If the project uses Python 3.11+ or PyTorch 2.1+, create a compatible environment
+ or explicitly test a source build. Do not present such combinations as supported.
- TorchDrug **0.2.1** (latest on PyPI, July 2023) requires **Python 3.7–3.10** and **PyTorch 1.8–2.0**. Install PyTorch and `torch-scatter` / `torch-cluster` first (wheel URL depends on your PyTorch and CUDA versions — see [installation docs](https://torchdrug.ai/docs/installation.html)).
+ ## Installation
+ Prefer a dedicated Python 3.10 environment and pin the TorchDrug release:
+
```bash
- uv pip install torch
- # Match torch/CUDA in the URL, e.g. torch-2.0.0+cu118 or cpu
- uv pip install torch-scatter torch-cluster -f https://pytorch-geometric.com/whl/torch-2.0.0+cu118.html
- uv pip install torchdrug==0.2.1
+ uv venv --python 3.10
+ source .venv/bin/activate
+ uv pip install "torch==2.0.0"
```
- On Apple Silicon, compile scatter/cluster from source; TorchDrug runs on CPU only (no MPS). Conda: `conda install torchdrug -c milagraph -c conda-forge -c pytorch -c pyg`.
+ Install `torch-scatter` and `torch-cluster` wheels matched to the exact PyTorch
+ and CUDA pair, following the
+ [official installation page](https://torchdrug.ai/docs/installation.html). For a
+ CPU-only PyTorch 2.0 environment, one reproducible wheel combination is:
- ### Quick Example
+ ```bash
+ uv pip install "torch-scatter==2.1.1" "torch-cluster==1.6.1" \
+ --find-links "https://data.pyg.org/whl/torch-2.0.0+cpu.html"
+ uv pip install "torchdrug==0.2.1"
+ ```
+ Do not copy a CUDA wheel URL between environments. Match the PyTorch version,
+ CUDA build, Python ABI, and platform. On Apple Silicon, the official docs require
+ building `torch-scatter` and `torch-cluster` from source; pin reviewed source
+ revisions and expect CPU execution.
+
+ ## Canonical property-prediction workflow
+
+ Use the documented ClinTox → GIN → `PropertyPrediction` → `Engine` pattern:
+
```python
import torch
- from torchdrug import datasets, models, tasks
- from torch.utils.data import DataLoader
+ from torchdrug import core, datasets, models, tasks
- # Load molecular dataset
- dataset = datasets.BBBP("~/molecule-datasets/")
- train_set, valid_set, test_set = dataset.split()
+ dataset = datasets.ClinTox("~/molecule-datasets/")
+ lengths = [int(0.8 * len(dataset)), int(0.1 * len(dataset))]
+ lengths.append(len(dataset) - sum(lengths))
+ train_set, valid_set, test_set = torch.utils.data.random_split(dataset, lengths)
- # Define GNN model
model = models.GIN(
input_dim=dataset.node_feature_dim,
- hidden_dims=[256, 256, 256],
- edge_input_dim=dataset.edge_feature_dim,
+ hidden_dims=[256, 256, 256, 256],
+ short_cut=True,
batch_norm=True,
- readout="mean"
+ concat_hidden=True,
)
-
- # Create property prediction task
task = tasks.PropertyPrediction(
model,
task=dataset.tasks,
criterion="bce",
- metric=["auroc", "auprc"]
+ metric=("auprc", "auroc"),
)
- # Train with PyTorch
optimizer = torch.optim.Adam(task.parameters(), lr=1e-3)
- train_loader = DataLoader(train_set, batch_size=32, shuffle=True)
-
- for epoch in range(100):
- for batch in train_loader:
- loss = task(batch)
- optimizer.zero_grad()
- loss.backward()
- optimizer.step()
- ```
-
- ## Core Capabilities
-
- ### 1. Molecular Property Prediction
-
- Predict chemical, physical, and biological properties of molecules from structure.
-
- **Use Cases:**
- - Drug-likeness and ADMET properties
- - Toxicity screening
- - Quantum chemistry properties
- - Binding affinity prediction
-
- **Key Components:**
- - 20+ molecular datasets (BBBP, HIV, Tox21, QM9, etc.)
- - GNN models (GIN, GAT, SchNet)
- - PropertyPrediction and MultipleBinaryClassification tasks
-
- **Reference:** See `references/molecular_property_prediction.md` for:
- - Complete dataset catalog
- - Model selection guide
- - Training workflows and best practices
- - Feature engineering details
-
- ### 2. Protein Modeling
-
- Work with protein sequences, structures, and properties.
-
- **Use Cases:**
- - Enzyme function prediction
- - Protein stability and solubility
- - Subcellular localization
- - Protein-protein interactions
- - Structure prediction
-
- **Key Components:**
- - 15+ protein datasets (EnzymeCommission, GeneOntology, PDBBind, etc.)
- - Sequence models (ESM, ProteinBERT, ProteinLSTM)
- - Structure models (GearNet, SchNet)
- - Multiple task types for different prediction levels
-
- **Reference:** See `references/protein_modeling.md` for:
- - Protein-specific datasets
- - Sequence vs structure models
- - Pre-training strategies
- - Integration with AlphaFold and ESM
-
- ### 3. Knowledge Graph Reasoning
-
- Predict missing links and relationships in biological knowledge graphs.
-
- **Use Cases:**
- - Drug repurposing
- - Disease mechanism discovery
- - Gene-disease associations
- - Multi-hop biomedical reasoning
-
- **Key Components:**
- - General KGs (FB15k, WN18) and biomedical (Hetionet)
- - Embedding models (TransE, RotatE, ComplEx)
- - KnowledgeGraphCompletion task
-
- **Reference:** See `references/knowledge_graphs.md` for:
- - Knowledge graph datasets (including Hetionet with 45k biomedical entities)
- - Embedding model comparison
- - Evaluation metrics and protocols
- - Biomedical applications
-
- ### 4. Molecular Generation
-
- Generate novel molecular structures with desired properties.
-
- **Use Cases:**
- - De novo drug design
- - Lead optimization
- - Chemical space exploration
- - Property-guided generation
-
- **Key Components:**
- - Autoregressive generation
- - GCPN (policy-based generation)
- - GraphAutoregressiveFlow
- - Property optimization workflows
-
- **Reference:** See `references/molecular_generation.md` for:
- - Generation strategies (unconditional, conditional, scaffold-based)
- - Multi-objective optimization
- - Validation and filtering
- - Integration with property prediction
-
- ### 5. Retrosynthesis
-
- Predict synthetic routes from target molecules to starting materials.
-
- **Use Cases:**
- - Synthesis planning
- - Route optimization
- - Synthetic accessibility assessment
- - Multi-step planning
-
- **Key Components:**
- - USPTO-50k reaction dataset
- - CenterIdentification (reaction center prediction)
- - SynthonCompletion (reactant prediction)
- - End-to-end Retrosynthesis pipeline
-
- **Reference:** See `references/retrosynthesis.md` for:
- - Task decomposition (center ID → synthon completion)
- - Multi-step synthesis planning
- - Commercial availability checking
- - Integration with other retrosynthesis tools
-
- ### 6. Graph Neural Network Models
-
- Comprehensive catalog of GNN architectures for different data types and tasks.
-
- **Available Models:**
- - General GNNs: GCN, GAT, GIN, RGCN, MPNN
- - 3D-aware: SchNet, GearNet
- - Protein-specific: ESM, ProteinBERT, GearNet
- - Knowledge graph: TransE, RotatE, ComplEx, SimplE
- - Generative: GraphAutoregressiveFlow
-
- **Reference:** See `references/models_architectures.md` for:
- - Detailed model descriptions
- - Model selection guide by task and dataset
- - Architecture comparisons
- - Implementation tips
-
- ### 7. Datasets
-
- 40+ curated datasets spanning chemistry, biology, and knowledge graphs.
-
- **Categories:**
- - Molecular properties (drug discovery, quantum chemistry)
- - Protein properties (function, structure, interactions)
- - Knowledge graphs (general and biomedical)
- - Retrosynthesis reactions
-
- **Reference:** See `references/datasets.md` for:
- - Complete dataset catalog with sizes and tasks
- - Dataset selection guide
- - Loading and preprocessing
- - Splitting strategies (random, scaffold)
-
- ## Common Workflows
-
- ### Workflow 1: Molecular Property Prediction
-
- **Scenario:** Predict blood-brain barrier penetration for drug candidates.
-
- **Steps:**
- 1. Load dataset: `datasets.BBBP()`
- 2. Choose model: GIN for molecular graphs
- 3. Define task: `PropertyPrediction` with binary classification
- 4. Train with scaffold split for realistic evaluation
- 5. Evaluate using AUROC and AUPRC
-
- **Navigation:** `references/molecular_property_prediction.md` → Dataset selection → Model selection → Training
-
- ### Workflow 2: Protein Function Prediction
-
- **Scenario:** Predict enzyme function from sequence.
-
- **Steps:**
- 1. Load dataset: `datasets.EnzymeCommission()`
- 2. Choose model: ESM (pre-trained) or GearNet (with structure)
- 3. Define task: `PropertyPrediction` with multi-class classification
- 4. Fine-tune pre-trained model or train from scratch
- 5. Evaluate using accuracy and per-class metrics
-
- **Navigation:** `references/protein_modeling.md` → Model selection (sequence vs structure) → Pre-training strategies
-
- ### Workflow 3: Drug Repurposing via Knowledge Graphs
-
- **Scenario:** Find new disease treatments in Hetionet.
-
- **Steps:**
- 1. Load dataset: `datasets.Hetionet()`
- 2. Choose model: RotatE or ComplEx
- 3. Define task: `KnowledgeGraphCompletion`
- 4. Train with negative sampling
- 5. Query for "Compound-treats-Disease" predictions
- 6. Filter by plausibility and mechanism
-
- **Navigation:** `references/knowledge_graphs.md` → Hetionet dataset → Model selection → Biomedical applications
-
- ### Workflow 4: De Novo Molecule Generation
-
- **Scenario:** Generate drug-like molecules optimized for target binding.
-
- **Steps:**
- 1. Train property predictor on activity data
- 2. Choose generation approach: GCPN for RL-based optimization
- 3. Define reward function combining affinity, drug-likeness, synthesizability
- 4. Generate candidates with property constraints
- 5. Validate chemistry and filter by drug-likeness
- 6. Rank by multi-objective scoring
-
- **Navigation:** `references/molecular_generation.md` → Conditional generation → Multi-objective optimization
-
- ### Workflow 5: Retrosynthesis Planning
-
- **Scenario:** Plan synthesis route for target molecule.
-
- **Steps:**
- 1. Load dataset: `datasets.USPTO50k()`
- 2. Train center identification model (RGCN)
- 3. Train synthon completion model (GIN)
- 4. Combine into end-to-end retrosynthesis pipeline
- 5. Apply recursively for multi-step planning
- 6. Check commercial availability of building blocks
-
- **Navigation:** `references/retrosynthesis.md` → Task types → Multi-step planning
-
- ## Integration Patterns
-
- ### With RDKit
-
- Convert between TorchDrug molecules and RDKit:
- ```python
- from torchdrug import data
- from rdkit import Chem
-
- # SMILES → TorchDrug molecule
- smiles = "CCO"
- mol = data.Molecule.from_smiles(smiles)
-
- # TorchDrug → RDKit
- rdkit_mol = mol.to_molecule()
-
- # RDKit → TorchDrug
- rdkit_mol = Chem.MolFromSmiles(smiles)
- mol = data.Molecule.from_molecule(rdkit_mol)
+ solver = core.Engine(
+ task,
+ train_set,
+ valid_set,
+ test_set,
+ optimizer,
+ batch_size=1024,
+ )
+ solver.train(num_epoch=100)
+ solver.evaluate("valid")
```
- ### With AlphaFold/ESM
-
- Use predicted structures:
- ```python
- from torchdrug import data
+ Add `gpus=[0]` only when a supported CUDA device is available. Omit `gpus` for
+ CPU execution.
- # Load AlphaFold predicted structure
- protein = data.Protein.from_pdb("AF-P12345-F1-model_v4.pdb")
+ For binary classification, `task.predict(batch)` returns logits; apply
+ `torch.sigmoid` when probabilities are needed. In 0.2.1, normalized regression
+ predictions are returned on the original target scale, which is a breaking change
+ from older releases.
- # Build graph with spatial edges
- graph = protein.residue_graph(
- node_position="ca",
- edge_types=["sequential", "radius"],
- radius_cutoff=10.0
- )
- ```
+ ## Choose the official workflow
- ### With PyTorch Lightning
+ ### Molecular property prediction
- Wrap tasks for Lightning training:
- ```python
- import pytorch_lightning as pl
+ - Dataset: `datasets.ClinTox`, `BBBP`, `Tox21`, `QM9`, or another documented
+ molecule dataset.
+ - Model: start with `models.GIN`; use `edge_input_dim` when the selected feature
+ configuration supplies edge features.
+ - Task: `tasks.PropertyPrediction`.
+ - Read [molecular property prediction](references/molecular_property_prediction.md).
- class LightningTask(pl.LightningModule):
- def __init__(self, torchdrug_task):
- super().__init__()
- self.task = torchdrug_task
+ ### Self-supervised molecular pretraining
- def training_step(self, batch, batch_idx):
- return self.task(batch)
+ - InfoGraph: `models.InfoGraph(gin_model, separate_model=False)` wrapped by
+ `tasks.Unsupervised`.
+ - Attribute masking: `tasks.AttributeMasking(model, mask_rate=0.15)`.
+ - Recreate the same encoder for fine-tuning, then load the checkpoint with
+ `strict=False` before training `tasks.PropertyPrediction`.
+ - Read [molecular property prediction](references/molecular_property_prediction.md).
- def validation_step(self, batch, batch_idx):
- pred = self.task.predict(batch)
- target = self.task.target(batch)
- return {"pred": pred, "target": target}
+ ### Molecule generation
- def configure_optimizers(self):
- return torch.optim.Adam(self.parameters(), lr=1e-3)
- ```
+ - Dataset: `datasets.ZINC250k(..., kekulize=True, atom_feature="symbol")`.
+ - GCPN: an `models.RGCN` encoder wrapped by `tasks.GCPNGeneration`.
+ - GraphAF: node and edge `models.GraphAF` flows wrapped by
+ `tasks.AutoregressiveGeneration`.
+ - Supported optimization tasks in the tutorial are `"qed"` and `"plogp"`;
+ criteria are `"nll"` and/or `"ppo"`.
+ - Read [molecular generation](references/molecular_generation.md).
- ## Technical Details
+ ### Retrosynthesis
- For deep dives into TorchDrug's architecture:
+ - Create two synchronized `datasets.USPTO50k` views: reaction mode for center
+ identification and `as_synthon=True` for synthon completion.
+ - Train `tasks.CenterIdentification` and `tasks.SynthonCompletion` separately.
+ - Combine the trained tasks with `tasks.Retrosynthesis`; do not pass raw models
+ directly to the end-to-end task.
+ - Read [retrosynthesis](references/retrosynthesis.md).
- **Core Concepts:** See `references/core_concepts.md` for:
- - Architecture philosophy (modular, configurable)
- - Data structures (Graph, Molecule, Protein, PackedGraph)
- - Model interface and forward function signature
- - Task interface (predict, target, forward, evaluate)
- - Training workflows and best practices
- - Loss functions and metrics
- - Common pitfalls and debugging
+ ### Knowledge graph reasoning
- ## Quick Reference Cheat Sheet
+ - Embedding workflow: `datasets.FB15k237` → `models.RotatE` →
+ `tasks.KnowledgeGraphCompletion`.
+ - Neural reasoning workflow: `models.NeuralLP` with `fact_ratio=0.75`.
+ - Read [knowledge graph reasoning](references/knowledge_graphs.md).
- **Choose Dataset:**
- - Molecular property → `references/datasets.md` → Molecular section
- - Protein task → `references/datasets.md` → Protein section
- - Knowledge graph → `references/datasets.md` → Knowledge graph section
+ ### Protein modeling
- **Choose Model:**
- - Molecules → `references/models_architectures.md` → GNN section → GIN/GAT/SchNet
- - Proteins (sequence) → `references/models_architectures.md` → Protein section → ESM
- - Proteins (structure) → `references/models_architectures.md` → Protein section → GearNet
- - Knowledge graph → `references/models_architectures.md` → KG section → RotatE/ComplEx
+ - Build proteins with `data.Protein.from_sequence`, `from_pdb`, or
+ `from_molecule`.
+ - Sequence encoders include `models.ESM`, `ProteinCNN`, `ProteinResNet`,
+ `ProteinLSTM`, and `ProteinBERT`; structure encoders include `models.GearNet`.
+ - Use documented graph-construction layers rather than a nonexistent
+ `protein.residue_graph()` convenience method.
+ - Read [protein modeling](references/protein_modeling.md).
- **Common Tasks:**
- - Property prediction → `references/molecular_property_prediction.md` or `references/protein_modeling.md`
- - Generation → `references/molecular_generation.md`
- - Retrosynthesis → `references/retrosynthesis.md`
- - KG reasoning → `references/knowledge_graphs.md`
+ ## Rules for reliable TorchDrug code
- **Understand Architecture:**
- - Data structures → `references/core_concepts.md` → Data Structures
- - Model design → `references/core_concepts.md` → Model Interface
- - Task design → `references/core_concepts.md` → Task Interface
+ 1. **Follow the 0.2.1 API.** The official docs are not a rolling latest-version
+ site.
+ 2. **Prefer documented feature names.** Use `atom_feature`, `bond_feature`,
+ `residue_feature`, and `mol_feature`; `node_feature`, `edge_feature`, and
+ `graph_feature` are deprecated aliases in relevant dataset constructors.
+ 3. **Let `Engine` preprocess tasks.** If composing pre-trained tasks without
+ constructing their solvers, call each task's `preprocess()` manually.
+ 4. **Keep paired splits synchronized.** For retrosynthesis, reset the same random
+ seed before splitting reaction and synthon datasets.
+ 5. **Use TorchDrug collation.** Use `data.graph_collate` or `core.Engine`;
+ generic PyTorch collation does not know how to pack TorchDrug graphs.
+ 6. **Separate model, task, and engine arguments.** A common source of invented
+ code is passing task options to a model or passing raw models where a composed
+ task is required.
+ 7. **Validate generated chemistry.** Treat model outputs as candidates, not as
+ experimentally valid or synthesizable compounds.
- ## Troubleshooting Common Issues
+ ## Troubleshooting
- **Issue: Dimension mismatch errors**
- → Check `model.input_dim` matches `dataset.node_feature_dim`
- → See `references/core_concepts.md` → Essential Attributes
+ ### Installation or import failure
- **Issue: Poor performance on molecular tasks**
- → Use scaffold splitting, not random
- → Try GIN instead of GCN
- → See `references/molecular_property_prediction.md` → Best Practices
+ Check Python, PyTorch, `torch-scatter`, and `torch-cluster` as one compatibility
+ set. Most failures are binary-wheel mismatches, unsupported Python versions, or
+ attempts to use MPS.
- **Issue: Protein model not learning**
- → Use pre-trained ESM for sequence tasks
- → Check edge construction for structure models
- → See `references/protein_modeling.md` → Training Workflows
+ ### Feature dimension mismatch
- **Issue: Memory errors with large graphs**
- → Reduce batch size
- → Use gradient accumulation
- → See `references/core_concepts.md` → Memory Efficiency
+ Build model dimensions from the loaded dataset:
- **Issue: Generated molecules are invalid**
- → Add validity constraints
- → Post-process with RDKit validation
- → See `references/molecular_generation.md` → Validation and Filtering
+ - `dataset.node_feature_dim`
+ - `dataset.edge_feature_dim`
+ - `dataset.num_bond_type`
+ - `dataset.num_entity` and `dataset.num_relation` for knowledge graphs
- ## Version Notes (0.2.1)
+ Do not hard-code dimensions copied from a different feature configuration.
- - `PropertyPrediction.predict()` returns **original-scale** values (not standardized); code written for older TorchDrug may need metric/threshold updates ([release notes](https://github.com/DeepGraphLearning/torchdrug/releases/tag/v0.2.1)).
- - Dataset constructors prefer `atom_feature` / `bond_feature` / `mol_feature`; `node_feature` / `edge_feature` / `graph_feature` are deprecated aliases.
- - `EvolutionaryScaleModeling` supports ESM-2 checkpoints in addition to ESM-1b.
+ ### Device mismatch
- ## Resources
+ Pass `gpus=[0]` to `core.Engine` for supported CUDA execution. For manual
+ prediction, collate first and move the entire nested batch with `utils.cuda`.
- **Official Documentation:** https://torchdrug.ai/docs/ (0.2.1)
- **GitHub:** https://github.com/DeepGraphLearning/torchdrug
- **Paper:** TorchDrug: A Powerful and Flexible Machine Learning Platform for Drug Discovery
+ ### Checkpoint mismatch
- ## Summary
+ Recreate the same model and feature configuration. For pretraining-to-fine-tuning
+ transfer, load the checkpoint's `"model"` state with `strict=False`; for a complete
+ solver, use `solver.save()` and `solver.load()`.
- Navigate to the appropriate reference file based on your task:
+ ## Reference index
- 1. **Molecular property prediction** → `molecular_property_prediction.md`
- 2. **Protein modeling** → `protein_modeling.md`
- 3. **Knowledge graphs** → `knowledge_graphs.md`
- 4. **Molecular generation** → `molecular_generation.md`
- 5. **Retrosynthesis** → `retrosynthesis.md`
- 6. **Model selection** → `models_architectures.md`
- 7. **Dataset selection** → `datasets.md`
- 8. **Technical details** → `core_concepts.md`
+ - [Core concepts and data structures](references/core_concepts.md)
+ - [Datasets](references/datasets.md)
+ - [Models and architectures](references/models_architectures.md)
+ - [Molecular property prediction and pretraining](references/molecular_property_prediction.md)
+ - [Protein modeling](references/protein_modeling.md)
+ - [Molecular generation](references/molecular_generation.md)
+ - [Retrosynthesis](references/retrosynthesis.md)
+ - [Knowledge graph reasoning](references/knowledge_graphs.md)
- Each reference provides comprehensive coverage of its domain with examples, best practices, and common use cases.
+ ## Upstream sources
+ - [TorchDrug 0.2.1 documentation](https://torchdrug.ai/docs/)
+ - [Tutorial index](https://torchdrug.ai/docs/tutorials/)
+ - [Installation](https://torchdrug.ai/docs/installation.html)
+ - [Package reference](https://torchdrug.ai/docs/api/)
+ - [TorchDrug 0.2.1 release notes](https://github.com/DeepGraphLearning/torchdrug/releases/tag/v0.2.1)