Skip to content
Agentmart
Submit a tool

alterlab-torchdrug

Builds PyTorch-native graph neural networks with TorchDrug for molecules and proteins, exposing custom GNN architectures, task/dataset abstractions, molecular…

Skill by AlterLab-IEU

IndexedApache-2.0★ 78
Write a review

Chalk Labs

Need help deploying alterlab-torchdrug?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/alterlab-ieu-alterlab-torchdrug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Builds PyTorch-native graph neural networks with TorchDrug for molecules and proteins, exposing custom GNN architectures, task/dataset abstractions, molecular generation, retrosynthesis planning, and knowledge-graph reasoning. Use when a project specifically needs TorchDrug's datasets and tasks — GearNet protein-structure models, center-identification/synthon-completion retrosynthesis, or Hetionet knowledge-graph baselines. TorchDrug has had no release since 0.2.1 (July 2023) and needs Python < 3.11, so for new custom GNN work prefer alterlab-torch-geometric, and for ready-made featurizers, MoleculeNet benchmarks, and pre-trained models prefer alterlab-deepchem. Part of the AlterLab Academic Skills suite.

Use cases: ml, research, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/alterlab-torchdrug

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read
  • Write
  • Edit
  • Bash(python:*)
  • Bash(uv:*)

What's inside

Skill name
alterlab-torchdrug
Description
Builds PyTorch-native graph neural networks with TorchDrug for molecules and proteins, exposing custom GNN architectures, task/dataset abstractions, molecular generation, retrosynthesis planning, and knowledge-graph reasoning. Use when a project specifically needs TorchDrug's datasets and tasks — GearNet protein-structure models, center-identification/synthon-completion retrosynthesis, or Hetionet knowledge-graph baselines. TorchDrug has had no release since 0.2.1 (July 2023) and needs Python < 3.11, so for new custom GNN work prefer alterlab-torch-geometric, and for ready-made featurizers, MoleculeNet benchmarks, and pre-trained models prefer alterlab-deepchem. Part of the AlterLab Academic Skills suite.
License
Apache-2.0
Compatibility
Self-contained — runs locally, no API key or account required. TorchDrug 0.2.1 (unmaintained, last release July 2023) requires Python >=3.7,<3.11 (use `uv venv --python 3.10`) plus torch-scatter/torch-cluster built for the installed torch and a C++ toolchain for its JIT extensions.
Allowed tools
Read, Write, Edit, Bash(python:*), Bash(uv:*)
Metadata
version: 1.1.0 · last_updated: 2026-09-23 · skill-author: AlterLab
Instructions
485 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (10)

  • SKILL.md
  • evals.json · evals/
  • core_concepts.md · references/
  • datasets.md · references/
  • knowledge_graphs.md · references/
  • models_architectures.md · references/
  • molecular_generation.md · references/
  • molecular_property_prediction.md · references/
  • protein_modeling.md · references/
  • retrosynthesis.md · references/

SKILL.md (first lines)

# TorchDrug

## Overview

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.

## When to Use This Skill

This skill should be used when working with:

**Data Types:**
- SMILES strings or molecular structures
- Protein sequences or 3D structures (PDB files)
- Chemical reactions and retrosynthesis
- Biomedical knowledge graphs
- Drug discovery datasets

**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

**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

### Does NOT Trigger

| Scenario | Use Instead |
|----------|-------------|
| Building a general custom GNN today (active library, current Python/torch) | `alterlab-torch-geometric` |
| Ready-made featurizers, MoleculeNet benchmarks, and pretrained models with less code | `alterlab-deepchem` |
| Only turning molecules into feature matrices for your own models | `alterlab-molfeat` |
| Only sourcing a labeled benchmark dataset (ADMET/DTI) with official splits | `alterlab-pytdc` |
| Querying an existing biomedical knowledge graph rather than training a KG model | `alterlab-primekg` |

## Getting Started

### Installation

```bash
# TorchDrug 0.2.1 (last release, Jul 2023) requires Python >=3.7,<3.11 and
# torch >=1.8. It will NOT solve on Python 3.11+ — pin an older interpreter:
uv venv --python 3.10
uv pip install torch                        # install torch first (see below)
# torch-scatter / torch-cluster ship only as sdists, so they compile against the
# installed torch — either install from the PyG wheel index or ensure a C++ toolchain:
uv pip install torch-scatter torch-cluster \
  --find-links "https://data.pyg.org/whl/torch-${TORCH_VERSION}+${CUDA}.html"  # e.g. cpu, cu121
uv pip install torchdrug==0.2.1
```

Gotchas:
- Install `torch` first; TorchDrug and `torch-scatter`/`torch-cluster` build graph ops against the installed torch, and mismatched builds fail at import.
- TorchDrug vendors its own `data.DataLoader`, `data.Graph`, and `core.Engine` — reach for those, not the bare PyTorch equivalents (see the loop below).
- TorchDrug depends on `rdkit-pypi`, which has no wheels past 2022.09 (Python ≤ 3.11) — another reason the stack is pinned to an older interpreter.
- It is unmaintained (no release since 0.2.1, July 2023); for new Python/torch stacks prefer `alterlab-torch-geometric` or `alterlab-deepchem`. Use this skill when you specifically need TorchDrug's task/dataset abstractions (e.g. GearNet, its retrosynthesis pipeline).

### Quick Example

```python
import torch
from torchdrug import data, datasets, models, tasks

# Load molecular dataset. MoleculeNet-style datasets such as BBBP have no .split()
# method (only datasets with predefined splits do) — split explicitly:
dataset = datasets.BBBP("~/molecule-datasets/")
lengths = [int(0.8 * len(dataset)), int(0.1 * len(dataset))]
lengths += [len(dataset) - sum(lengths)]
train_set, valid_set, test_set = data.ordered_scaffold_split(dataset, lengths)
# (or torch.utils.data.random_split(dataset, lengths) for a random split)

# Define GNN model
model = models.GIN(
    input_dim=dataset.node_feature_dim,
    hidden_dims=[256, 256, 256],
    edge_input_dim=dataset.edge_feature_dim,
    batch_norm=True,
    readout="mean"
)

# Create property prediction task
task = tasks.PropertyPrediction(
    model,
    task=dataset.tasks,
    criterion="bce",
    metric=["auroc", "auprc"]
)

# Train with a native PyTorch loop.
# preprocess() builds the task's MLP prediction head (and label statistics) — core.Engine
# calls it for you; in a manual loop call it BEFORE creating the optimizer, or the head
# is missing and its parameters are never optimized.
task.preprocess(train_set, valid_set, test_set)
# NOTE: use torchdrug.data.DataLoader (NOT torch.utils.data.DataLoader) — its
# default graph_collate packs data.Graph objects; the stock PyTorch collate cannot.
optimizer = torch.optim.Adam(task.parameters(), lr=1e-3)
train_loader = data.DataLoader(train_set, batch_size=32, shuffle=True)

for epoch in range(100):
    for batch in train_loader:
        # task.forward returns (loss, metric), not a bare tensor.
        loss, metric = task(batch)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()
```

For the standard (non-custom) path, `core.Engine(task, train_set, valid_set, test_set, optimizer, batch_size=...)` wraps this loop and handles batching/devices. Use the manual loop above when you need full control over the training step.

## Core Capabilities

### 1. Molecular Property Prediction

From AlterLab-IEU/AlterLab-Academic-Skills, Apache-2.0.

More from AlterLab-IEU/AlterLab-Academic-Skills

Signals

Stars
78
Forks
16
Open issues
1
Last commit (this folder)
Sep 23, 2026 (1 month ago)
Last release
Sep 23, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from AlterLab-IEU

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get alterlab-torchdrug running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying alterlab-torchdrug?

CallGet help
Cite this page

alterlab-torchdrug skill. Agent Mart. https://agentmart.dev/skills/alterlab-ieu-alterlab-torchdrug (last updated 2026-10-24)