Repository navigation
refactor: move AF3 model running out of the backend - #660
Merged
Merged
Conversation
ConfigurableModel, ModelRunner, ResultsForSeed, predict_structure, process_fold_input, _record_inference_kernels and _initialise_tokamax_trace_context move unchanged to alphafold3_runner.py, the part adapted from upstream run_alphafold.py, so it can be diffed against it on its own. The runner imports the output writers and the debug writer; the output module names ResultsForSeed only for type checking, from the runner. The backend keeps AlphaFold3Backend and re-exports process_fold_input, predict_structure and ResultsForSeed for callers that import them from it. Unit tests of runner code patch and call it in the runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup's nested make_model_config becomes a runner function, without the leftover "new code approach" comments; its docstring says once why every field is set behind hasattr: AF3 releases differ in which fields their config has (return_distogram is newer than the rest). setup looks up model.Model once per call and passes it to both the config and the runner, as the nested import did. predict's buckets is typed as what it accepts, an int or a sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Last of three behaviour-preserving PRs that split
alphafold3_backend.py; stacked on the input-preparation PR (#659). The backend goes from 2,455 lines onmainto 300, holding onlyAlphaFold3Backend(setup,prepare_input,predict,postprocess).Layout after the three PRs
alphafold3_backend.pyAlphaFold3Backend; re-exportsprocess_fold_input,predict_structure,ResultsForSeedalphafold3_inputs.pyFoldInputBuilder,PreparedFold)alphafold3_runner.pyrun_alphafold.pyalphafold3_outputs.pyalphafold3_debug.pyutils/output_paths.pyNo extracted module imports the backend.
alphafold3_outputsnamesResultsForSeedonly for type checking.Commits
ConfigurableModel,ModelRunner,ResultsForSeed,predict_structure,process_fold_input,_record_inference_kernelsand_initialise_tokamax_trace_contextgo unchanged toalphafold3_runner.py, so the code adapted from upstream can be diffed against it on its own. The backend re-exports what callers import from it. Unit tests of runner code patch and call it in the runner.setuptidied:make_model_configbecomes a runner function, without the leftover "new code approach" comments.hasattr: AF3 releases differ in which fields their config has.return_distogramcame to the AF3 history later than the others (2025-05).setuplooks upmodel.Modelonce per call and passes it to both the config and the runner, as the nested import did.predict'sbucketsis typed as what it accepts: an int or a sequence.Verification
main.mainplus the 6 builder tests of the previous PR. AF2 image: 937 passed, 26 skipped. AF3 image: 1008 passed, 15 skipped. The same pre-existing environmental failures.RUN_EXPENSIVE_GPU_TESTS=1: 39/39 passed, includingTestAlphaFold3MetadataEndToEnd(real feature generation through inference and ModelCIF), resume, fast kernels and the MMseqs/regression checks.🤖 Generated with Claude Code