Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Make multiprocessing attributes an instance property of Inferencer#329

Merged
tanaysoni merged 4 commits intomasterfrom
inferencer-multiprocessing
Apr 20, 2020
Merged

Make multiprocessing attributes an instance property of Inferencer#329
tanaysoni merged 4 commits intomasterfrom
inferencer-multiprocessing

Conversation

@tanaysoni
Copy link
Copy Markdown
Contributor

In the current implementation, for each execution of Inferencer.inference_from_dicts() we create and tear-down an instance of multiprocessing.Pool. This leads to problems when using the Inferencer in HTTP frameworks like FastAPI/Uvicorn/Gunicorn stack.

To address the issue, this PR makes changes to initialize a multiprocessing.Pool at the class-instance level of Inferencer. This Pool gets re-used for all inference requests.

With the new changes, the num_processes is supplied as an argument when loading an Inferencer instead of supplying it in inference_from_dicts().

@tanaysoni tanaysoni requested a review from tholor April 20, 2020 08:46
Copy link
Copy Markdown
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants