Run this model with HF Jobs

Run aurekaresearch/OpenDDE on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/aurekaresearch/OpenDDE. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/aurekaresearch/OpenDDE on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
OpenDDE / docs /inference_instructions.md
aurekaresearch's picture
Update model card, docs, assets, licenses, and config for OpenDDE 2.0.0 (#4)
84f68d9
|
Raw History Blame Contribute Delete
10.1 kB

Inference Instructions

Concise reference for preparing runtime data and running the inference commands of runner/batch_inference.py.

Environment

Run commands either inside the official aurekaresearch/opendde:v2 Docker image (which ships Python 3.13, PyTorch 2.12, opendde CLI, and OpenDDE-Kernel GPU acceleration pre-installed) or from a source checkout installed with uv, as described in the README. At runtime, --device auto uses CUDA when available, then Apple Silicon MPS, and otherwise falls back to CPU.

Runtime data

Set OPENDDE_ROOT_DIR to the directory that stores checkpoints and runtime data:

$OPENDDE_ROOT_DIR/
β”œβ”€β”€ checkpoint/opendde_v2.pt
β”œβ”€β”€ common/
└── search_database/        # needed for local template/RNA-MSA search

Inference loads the checkpoint from --load_checkpoint_path, or else the released checkpoint of the model under $OPENDDE_ROOT_DIR/checkpoint/; it does not download checkpoints. Missing common/ files are downloaded on first use.

common/components.cif.rdkit_mol.pkl is the prebuilt CCD cache (reference conformers of every CCD component). It was generated offline with rdkit 2025.9.3 and pdbeccdutils 1.0.4; inference only reads it. The rdkit 2026.9.1 of this image reads the cache bit-identically (inference features of CCD ligands were verified unchanged against rdkit 2025.9.3). Only SMILES ligands, whose reference conformer is generated at run time with ETKDG, depend on the rdkit version.

Prepare data from a source checkout:

export OPENDDE_ROOT_DIR=/path/to/opendde_data
bash scripts/download_opendde_data.sh

For a protein-only prediction that disables MSA, template, and RNA-MSA features, search databases are not needed:

bash scripts/download_opendde_data.sh --skip-search-database

If you already have a custom checkpoint, keep a descriptive filename and pass it directly. Use --skip-model when preparing only the remaining runtime data:

mkdir -p "$OPENDDE_ROOT_DIR/checkpoint"
cp /path/to/my_checkpoint.pt \
  "$OPENDDE_ROOT_DIR/checkpoint/my_checkpoint.pt"
bash scripts/download_opendde_data.sh --skip-model
python runner/batch_inference.py pred \
  --load_checkpoint_path "$OPENDDE_ROOT_DIR/checkpoint/my_checkpoint.pt" \
  -i examples/cofold/input.json \
  -o ./output

The names opendde_v2.pt, opendde.pt and opendde_abag.pt are reserved for released assets. Their authoritative links, sizes, and digests are in supported_models.md.

opendde_v2.pt is the default checkpoint of the default model opendde_v2; opendde.pt is the default checkpoint of -n opendde_v1. The ABAG-optimized checkpoint is an opendde_v1 checkpoint: keep it as opendde_abag.pt and pass it with -n opendde_v1 --load_checkpoint_path, for example python runner/batch_inference.py pred -n opendde_v1 --load_checkpoint_path "$OPENDDE_ROOT_DIR/checkpoint/opendde_abag.pt".

Install the ABAG checkpoint with the same helper:

export OPENDDE_ROOT_DIR=/path/to/opendde_data
bash scripts/download_opendde_data.sh \
  --checkpoint opendde_abag.pt \
  --skip-common \
  --skip-search-database

Then run general-purpose inference without an explicit checkpoint path. For ABAG inference, add:

-n opendde_v1 --load_checkpoint_path "$OPENDDE_ROOT_DIR/checkpoint/opendde_abag.pt"

Useful environment variables:

Variable Purpose
OPENDDE_ROOT_DIR Checkpoints, common files, search databases. Defaults to ~/.cache/opendde.
OPENDDE_DEPENDENCY_URL Override the checkpoint download root of scripts/download_opendde_data.sh.
OPENDDE_COMMON_URL Override common runtime file download root. Falls back to OPENDDE_DEPENDENCY_URL when set.
OPENDDE_SEARCH_DATABASE_URL Override template/RNA-MSA database download root.
LAYERNORM_TYPE LayerNorm backend; defaults to torch. Set to fast_layernorm to opt into the fused kernel.
TRIANGLE_ATTENTION / TRIANGLE_MULTIPLICATIVE Triangle kernel selection, cuequivariance or torch; the CLI flags --triatt_kernel / --trimul_kernel default to auto.
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True Useful for large inputs.

Template/RNA-MSA preprocessing also needs HMMER. Template inference may need kalign:

apt-get update && apt-get install -y hmmer kalign

Input JSON

OpenDDE input is a top-level list of jobs:

[
  {
    "name": "tiny",
    "modelSeeds": [101],
    "sequences": [
      {
        "proteinChain": {
          "sequence": "ACDEFGHIK",
          "count": 1
        }
      }
    ]
  }
]

covalent_bonds is optional and may be omitted from a job; include it only to declare explicit covalent links between entities.

Full schema: infer_json_format.md.

Convert a structure file to JSON:

python runner/batch_inference.py json -i examples/cofold/structures/7pzb.pdb -o ./output --altloc first
python runner/batch_inference.py json -i examples/cofold/structures/2lwu.cif -o ./output --altloc first --assembly_id 1

Preprocess optional features

# Protein MSA
python runner/batch_inference.py msa -i examples/cofold/input.json -o ./output

# Protein MSA + template search
python runner/batch_inference.py mt -i examples/cofold/input.json -o ./output

# Protein MSA + template search + RNA MSA when RNA is present
python runner/batch_inference.py prep -i examples/cofold/input.json -o ./output

Notes:

  • Protein MSA uses the public ColabFold MMseqs2 API unless A3M paths are already present in the JSON.
  • Template and RNA-MSA search use local databases under $OPENDDE_ROOT_DIR/search_database/.
  • Updated JSON files are written next to the input JSON.

Details: msa_template_pipeline.md.

Run prediction

Standard run:

python runner/batch_inference.py pred -i examples/cofold/input.json -o ./output -n opendde_v2

Compatibility run with the standard step/cycle counts:

python runner/batch_inference.py pred \
  -i examples/cofold/input.json \
  -o ./output \
  -n opendde_v2 \
  --use_msa false \
  --use_template false \
  --use_rna_msa false \
  --sample 1 \
  --step 200 \
  --cycle 10

Inference defaults to --device auto, bf16, and auto triangle kernels. Device auto-selection uses NVIDIA CUDA when available and otherwise CPU. cuEquivariance is selected only when its Linux CUDA packages import successfully; otherwise the model uses PyTorch triangle kernels.

Multi-GPU inference

Launching with torchrun shards whole inference jobs across GPUs (data parallel); every job still runs on a single GPU. For example, four GPUs use:

CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --standalone --nproc_per_node 4 \
  -m runner.batch_inference pred \
  -i ./inputs \
  -o ./output \
  -n opendde_v2

Use prepared features:

python runner/batch_inference.py pred -i examples/cofold/template/example_9fm7.json \
  -o ./output -n opendde_v2 \
  --use_msa true --use_template true

python runner/batch_inference.py pred -i examples/cofold/rna_msa/example_9gmw_2.json \
  -o ./output -n opendde_v2 \
  --use_rna_msa true

Constraints

opendde_v2 can be conditioned on distances with the job-level distance_constraint field; no flag is needed:

python runner/batch_inference.py pred -i examples/constraint/example_constraint_msa.json \
  -o ./output -n opendde_v2 --use_msa true

The constraint field (contacts, epitopes) is applied through TFG guidance, below. Usage of both is described in the README.

Optional TFG Guidance

OpenDDE includes default-off Training-Free Guidance (TFG). TFG refines each sampled trajectory with geometry potentials while keeping the requested --sample count unchanged.

python runner/batch_inference.py pred -i examples/cofold/input.json -o ./output -n opendde_v2 \
  --use_tfg_guidance true

Outputs are written to:

<out_dir>/<job_name>/seed_<seed>/predictions/

Seeds and reproducibility

Each (job, seed) is seeded on its own: seed_everything(seed) runs before featurization, MSA subsampling draws from the global RNG, and the diffusion sampler draws its noise from a dedicated torch.Generator seeded with the same seed. A prediction therefore depends only on the job and the seed, not on which other jobs ran before it in the same JSON or process.

Common flags

Flag Meaning
-n, --model_name Model name: opendde_v2 (default) or opendde_v1.
--load_checkpoint_path Explicit checkpoint path.
--seeds Comma-separated seeds, e.g. 101,102. Overrides the job's modelSeeds; if unset, modelSeeds are used, or a random seed when both are absent.
--use_msa Use/generate protein MSA features.
--use_template Use/generate template features.
--use_rna_msa Use/generate RNA MSA features; requires --use_msa true.
--use_tfg_guidance Enable Training-Free Guidance.
--dtype bf16 or fp32.
--device auto, cpu, or cuda; auto uses CUDA when available and otherwise CPU.
--trimul_kernel, --triatt_kernel auto, cuequivariance, or torch.

Run python runner/batch_inference.py <command> --help for the full option list.

Cost and precision policy

pred defaults to model.N_cycle=10, sample_diffusion.N_step=200, sample_diffusion.N_sample=5 and dtype=bf16. Use --cycle, --step, --sample and --dtype bf16 to trade cost against precision. MSA, template and RNA-MSA preprocessing add separate CPU, network and database cost when enabled.

With an AMP dtype such as bf16, runner/inference.py::update_inference_configs keeps the most sensitive modules in FP32 for smaller inputs and enables AMP as the token count grows:

  • N_token <= 2560: sample diffusion and confidence head stay in FP32.
  • 2560 < N_token <= 3840: confidence head uses AMP; sample diffusion stays in FP32.
  • N_token > 3840: both sample diffusion and confidence head use AMP.