Skip to content
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

InferenceClient: provide generator-based bulk inference #68

Open
mhaas opened this issue Aug 5, 2020 · 0 comments
Open

InferenceClient: provide generator-based bulk inference #68

mhaas opened this issue Aug 5, 2020 · 0 comments

Comments

@mhaas
Copy link
Member

mhaas commented Aug 5, 2020

The current implementation will try to perform inference for all chunks. If an exception occurs, the progress is lost.

By yielding the individual chunks, the caller can be in charge of error handling.

We can either change the existing API or introduce a separate method (and implement do_bulk_inference using the new method).

See also #62

mhaas added a commit that referenced this issue May 19, 2022
In case of errors, the `InferenceClient.do_bulk_inference` method
will now return `None` for the affected objects instead of aborting
the entire bulk inference operation (and discarding any successfully
processed objects).

Fixes issue #68

The fix for #68 is different than what is described in #68. Instead of
using a generator based approach which will require the SDK consumer to
implement the error handling themselves, the SDK itself now handles the
errors. The downside of not using a generator is a larger memory footprint
to accumulate the results in a list. As an alternative, we can consider
using a generator to either yield the successfully processed inference
results or the list containing `None`. This approach will save memory.

Additionally, this commit introduces parallel processing in `InferenceClient.do_bulk_inference`.
This will greatly improve performance. Due to the non-lazy implementation of
`ThreadPoolProcessor.map`, this increases memory usage slightly ([cpython issue #74028])

[cpython issue #74028]: python/cpython#74028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant