Skip to content

feat: add resident inference batches - #636

Draft
DimaMolod wants to merge 7 commits into
mainfrom
feat/resident-inference
Draft

feat: add resident inference batches#636
DimaMolod wants to merge 7 commits into
mainfrom
feat/resident-inference

Conversation

@DimaMolod

@DimaMolod DimaMolod commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a reusable resident inference batch module for AF2 and AF3
  • load each model once and process JSONL-described jobs sequentially
  • isolate per-job failures while preserving successful outputs
  • keep the existing single-job command on the same implementation path

Tests

  • focused resident tests: 91 passed
  • unit suite: 404 passed, 4 skipped
  • GitHub CI: smoke tests, coverage, AF2 image, and AF3 image passed

Companion workflow PR: KosinskiLab/AlphaPulldownSnakemake#53.

Related MMseqs2-GPU core PR: #637.

DimaMolod and others added 6 commits September 3, 2026 13:58
AlphaFold2 inference is JAX-compiled, so a fresh process recompiles every model
runner and a resident batch recompiles whenever the input shape changes.

- accept --jax_compilation_cache_dir for the alphafold2 backend and apply it in
  setup(), so separate per-fold processes can share a persistent compile cache
- allow --desired_num_res without --desired_num_msa, defaulting the MSA bound to
  the fold's own depth, so a batch can be padded to one shape from the residue
  count alone

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
pre_modelling_setup and AlphaPulldownPredictionAdapter._prepare_protein_object were
near-identical retypes, and a `command -v` test in the workflow chose between them.
They disagreed: the single-fold copy reassigned its metadata glob inside the
feature-directory loop and tested it outside, so only the last feature directory
could contribute, and it copied every match rather than the newest. The same fold
produced different output depending on the container's age.

- add alphapulldown/fold_preparation.py with prepare_fold(); both callers delegate
- keep the batch behaviour: consider every feature directory, copy the newest match
- name the warning after the description the search used, not the fragment name
- retarget the entry-point tests at the shared module and drop its cached copy in
  the module-fabrication harness

426 passed; the one remaining failure predates this change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Which flags each backend accepts was stated once in run_structure_prediction.py and
copied by hand into the workflow, where it drifted. The configuration dict handed to
backend.setup was retyped verbatim in two places, and since every backend absorbs
what it does not recognise in **kwargs, a mistyped key there was dropped in silence.

- add alphapulldown/inference_flags.py: per-backend flag sets, one declarative
  key->attribute mapping for the model and postprocess configuration, and
  validate_model_configuration()
- _validate_flags_for_backend, default_model_flags, default_postprocess_flags and
  the batch adapter's copies all delegate to it
- both adapters validate the configuration before calling setup, so an unknown key
  is an error instead of a setting that never takes effect

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant