Repository navigation
fix(inference): let the batched engine accept only_return_standard_out - #1353
Open
aniruddhaadak80 wants to merge 3 commits into
Open
aniruddhaadak80 wants to merge 3 commits into
aniruddhaadak80 wants to merge 3 commits into
Conversation
get_embeddings() calls iter_outputs() with only_return_standard_out=False. Three of the four engines accepted the keyword; InferenceEngineBatched NoPreprocessing did not and hardcoded True on the model call, so get_embeddings raised TypeError whenever the batched engine was active - which is the mode finetuning leaves its estimator in.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a37935a. Configure here.
Contributor
Author
|
Thanks - both points taken. Fixed in db77a51.
|
3 tasks done
This branch has not been deployed
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.

Issue
Fixes #1348
Motivation and Context
get_embeddings (�ase.py ~736) calls
python for output, config in model.executor_.iter_outputs( X, autocast=model.use_autocast_, task_type=task_type, only_return_standard_out=False, )Three of the four engines accept that keyword. InferenceEngineBatchedNoPreprocessing.iter_outputs (~775) declares only X, �utocast and ask_type, and hardcodes only_return_standard_out=True on the model call, so calling it this way raises:
TypeError: iter_outputs() got an unexpected keyword argument 'only_return_standard_out'The abstract declaration InferenceEngine.iter_outputs (~361) omits the parameter as well, which is how the gap survived in one implementation while the other three grew it.
The batched engine is what finetuning leaves its estimator in (it_mode="batched"), so inetuned_estimator_.get_embeddings(X_test) crashes for exactly the estimators the embeddings feature is most useful on.
The fix declares only_return_standard_out: bool = True on both the ABC and the batched engine, and threads it to the model call in place of the hardcoded True, matching the convention the other three engines already use.
Public API Changes
InferenceEngine.iter_outputs gains only_return_standard_out: bool = True on its abstract signature, and InferenceEngineBatchedNoPreprocessing.iter_outputs now accepts it. Existing callers are unaffected - the parameter defaults to True, which is the value the batched engine previously hardcoded.
How Has This Been Tested?
Two tests in ests/test_inference.py:
All five cases fail on the unfixed source and pass with the fix:
`
unfixed source
FAILED ...::test__iter_outputs__batched_honours_only_return_standard_out
FAILED ...::test__iter_outputs__every_engine_accepts_only_return_standard_out[InferenceEngineOnDemand]
FAILED ...::test__iter_outputs__every_engine_accepts_only_return_standard_out[InferenceEngineCachePreprocessing]
FAILED ...::test__iter_outputs__every_engine_accepts_only_return_standard_out[InferenceEngineBatchedNoPreprocessing]
FAILED ...::test__iter_outputs__every_engine_accepts_only_return_standard_out[InferenceEngineExplicitKVCache]
5 failed, 31 deselected
with the fix
5 passed, 31 deselected in 2.87s
`
uff check and
uff format --check are clean.
Checklist