-
Notifications
You must be signed in to change notification settings - Fork 248
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
Fix and document Inferencer usage and pool handling #429
Conversation
03d3d49
to
2916513
Compare
Hi @PhilipMay, I added a suggestion commit with a call to the |
Well, that does not fully work because you would have to wrap the code into a try and finally block to even close the pool when an exception is raised. |
And to avoid this kind of "ugly and complicated" code I would better not open a pool... So the example is easy to read. |
Hi @PhilipMay, In the case of exception in the Inferencer, the example scripts would crash, terminating all the Python subprocesses. For instance, the following script should exit clean without any zombie processes. results = inferencer.inference_from_dicts(qa_input)
print(results)
raise Exception # scripts exits here
inferencer.close_multiprocessing_pool() |
@tanaysoni Yes I agree. In the example it does not cause any direct problems. But IMO an example should be something that can be taken and put into something bigger. If placed in a real life server environment this might cause an ugly memory leak if not handled correctly. But we already had this discussion on an other PR if I remember correctly. |
So what do you suggest we can do with this uncompleted PR? In which direction should we go? |
Hi @PhilipMay, IMO we add a call to |
33615a2
to
18c8f40
Compare
Hi @PhilipMay, thanks again for bringing this up and working on it! I added an additional example |
Ok. Thanks. 👍 |
This is the 2nd part of PR #403
TODO
fit_s3e_on_corpus
docs/basic_usage.rst
docs/examples.rst
tutorials/1_farm_building_blocks.ipynb