-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch suggest operation #579
Comments
I played around with this a bit, and some questions arose. CLI usage
REST usage:
|
CLI
My hunch would be to try to extend the current
I think this is the way to go. For easier grepping etc., I would perhaps add some kind of extra tag in addition to the filename, something like:
I think it would be logical to use this output format whenever named files are used (instead of stdin), even if there is just one file.
Yes, and I think this is where we could expect the most benefits. For example REST
I agree that JSON encoding seems like a good choice here, but there are other options that perhaps shouldn't be dismissed outright:
If we go for the JSON encoding, the parameters could also be given as URL parameters: A little nitpick: why did you use an array here? I think a single object would be enough. "parameters": [
{
"language": "string",
"limit": 10,
"threshold": 0
}
] FWIW, I also checked the Maui Server API, but it doesn't have a batched version of |
Currently all the
suggest
methods (CLI command, REST API method, project and backend methods) always take just one document at a time. This is inefficient for backends that could process many documents in parallel.We should introduce a batch version of
suggest
(called e.g.suggest_batch
orsuggest_many
unless someone has a better idea?) for each of these contexts. Individual backends can then choose to implement it when it gives a performance boost; otherwise, the batch is simply passed to the regularsuggest
method one document at a time. I believe that at least NN ensemble, SVC, fastText and MLLM backends could benefit from parallel suggest operations. Also, this would be very useful for the proposed XTransformer backend.A note on scope: This issue is about implementing the scaffolding necessary for batching suggest operations, as well as using them in at least some (not necessarily all) operations that would benefit from it: e.g. eval, hyperopt, optimize, index. Changes to individual backends are out of scope but separate issues for them should be opened after this basic scaffolding is in place.
The text was updated successfully, but these errors were encountered: