Repository navigation
refactor: share session setup and prediction between the two adapters - #666
Merged
Merged
Conversation
PreparedPredictionAdapter (the single-fold command) and AlphaPulldownPredictionAdapter (the batch command) each validated the configuration, selected and set up the backend, picked the seed, predicted and post-processed every yielded fold, in two copies a fix had to reach twice. Two private helpers now do it, and both adapters delegate to them; parsing, feature loading, output directories and fold composition stay in the adapters. Behaviour is unchanged: one setup per resident batch, the seed chosen once per command or batch job as before, a resumed fold that yields nothing still counts as done, and setup errors propagate while a job's own failure leaves the others running. New tests drive both adapters with the same prepared fold and compare every backend call, and fail a job in prediction or in post-processing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Plan item 2 of 3: share the prediction execution code between the two adapters.
Problem
PreparedPredictionAdapter(the single-fold command) andAlphaPulldownPredictionAdapter(the batch command) each had their own copy of:A fix had to reach both copies.
Change
Two private helpers in
prediction_batch.py, used by both adapters:_setup_sessionvalidates the configuration, selects the backend, sets it up and returns the existing session object._predict_and_postprocesschooses the seed with the existing policy, predicts, and post-processes each yielded fold.Parsing, feature loading, output-directory resolution and fold composition stay in the adapters. The classes, method signatures, session object and backend result dictionaries are all unchanged.
Behaviour kept
Tests
main, plus the new tests. AF2 image: 978 passed. AF3 image: 1049 passed.mainafter this round is merged.🤖 Generated with Claude Code