fix(training): use singular candidate kwargs in test_step - #433
Open
ChrisW09 wants to merge 2 commits into
Open
Conversation
test_step called predict_with_candidates with candidates_x/candidates_y, but TabR and ModernNCA both define the method as (self, *data, candidate_x, candidate_y) with no **kwargs, so trainer.test() on any candidate model raised TypeError. predict_step already used the correct names. Part of #413 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
compute_loss is typed as returning float, and estimator is typed nn.Module; cast for the stub's recorded kwargs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Part of #413 (the wiring half; the retrieval-leakage half of that issue is not addressed here).
Problem
TaskModel.test_stepcalls:but both implementations —
deeptab/architectures/tabr.pyanddeeptab/architectures/experimental/modern_nca.py— are declared asdef predict_with_candidates(self, *data, candidate_x, candidate_y)with no**kwargs. Sotrainer.test(...)on any TabR/ModernNCA model always raisesTypeError: predict_with_candidates() got an unexpected keyword argument.predict_step(a few lines below) already uses the singular names, which is what the intended spelling is.Fix
Rename the two kwargs at the call site.
Tests
New
tests/test_candidate_models.pydrivestest_stepandpredict_stepwith a minimal stub estimator that has TabR's signature and records what it received. Verified the newtest_steptest fails onmainand passes with the fix.🤖 Generated with Claude Code