fix(infer): skip invalid dataset samples - #9848
Open
RerankerGuo wants to merge 1 commit into
Open
Conversation
Propagate the inference strict setting to the engine and skip failed responses while preserving valid batch results. Fixes modelscope#7045 Test: python -m unittest tests.infer.test_infer_pipeline
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
PR type
PR information
Fixes #7045.
Background
InferArguments.strictdefaults toFalse, butSwiftInferdid notpropagate that setting to its inference engine. Template encoding
therefore still raised on the first invalid image, audio, or other
sample instead of allowing the remaining dataset to continue.
There was a second failure path when strict mode was disabled manually:
the engine returned the per-sample exception in its aligned response
list, and
_batch_infer()attempted to accessresp.choices, raisingAttributeError.Changes
args.strictto the inference engine created bySwiftInfer.with a warning that preserves the original error message.
valid/invalid batch results.
Verification
PYTHONPATH=. .venv/bin/python -m unittest tests.infer.test_infer_pipelinePYTHONPATH=. .venv/bin/python tests/run.py --pattern test_infer_pipeline.pyPYTHONPATH=. .venv/bin/python -m unittest tests.infer.test_infer_pipeline tests.general.test_data_preprocess.TestProviderMessagesPreprocess tests.general.test_data_preprocess.TestRejectedMessagesPreprocess.venv/bin/pre-commit run --all-filesgit diff --checkImpact
The change affects dataset inference when
strict=False. Valid samplesretain their existing outputs and labels; invalid samples are logged and
omitted from the result list. Strict inference and deployment behavior
remain unchanged.
Experiment results
Before the fix, the regression tests failed because the engine had no
propagated
strictvalue and because an exception response was treatedas a normal completion. After the fix, both cases pass and valid samples
before and after the failed entry are preserved.