Fix PredictInput::Batch and expect pairs as nested tuples#801
Open
alvarobartt wants to merge 4 commits into
Open
Fix PredictInput::Batch and expect pairs as nested tuples#801alvarobartt wants to merge 4 commits into
PredictInput::Batch and expect pairs as nested tuples#801alvarobartt wants to merge 4 commits into
Conversation
michaelfeil
reviewed
Jan 11, 2026
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.
What does this PR do?
This PR allows a
Vec<String>with length > 2 to be provided asPredictInput::Batch, given that it was preventing some routes as/predicton processing with more than 2 sequences as those were considered "pairs".This PR represents a breaking change on how the
/predictmethod works, as before this PR pairs could be provided as[a,b]or[[a,b]], but the fact that[a,b]was allowed was preventing the inputs to be a batch of sequences, given that it was limited to two sequences, and then interpreted as a pair rather than as two individual sequences.So on, from now on, only the following are allowed:
"inputs": "a""inputs":["a", ...](allows from 1 to N, defined by the--max-client-batch-sizewith a default value of 32)"inputs":[["a"], ...]and"inputs":[["a","b"], ...], respectively; or combined as"inputs":[["a"], ["b", "c"], ...].Warning
It's a breaking change being introduced without a deprecation warning or prior notice, given that treating a batch of sequences as a pair, which implies that the strings there are concatenated into a single sequence, and limiting the length of batches of sequences to 2; can be misleading and/or incorrect.
Since before calling
/predictwith{"inputs":["I love tennis", "I hate tennis"]}was not running the forward pass on a batch of["I love tennis", "I hate tennis"], but rather running on a single sequence formed by the concatenation of both sequences in the batch, leading then to a single classification score, rather than an independent score per sequence; and also preventing the user from running with larger batches.Fixes #747
Before submitting
instasnapshots?Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.