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

Cannot close SpawnProcess for multiprocessing model.stop_multi_process() #1660

Open
Muennighoff opened this issue Aug 4, 2022 · 3 comments

Comments

@Muennighoff
Copy link
Contributor

Muennighoff commented Aug 4, 2022

Upon running model.stop_multi_process()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-17-8a9d42a11ec1> in <module>
      4 for p in pool['processes']:
      5     p.join()
----> 6     p.close()
      7 
      8 pool['input'].close()

AttributeError: 'SpawnProcess' object has no attribute 'close'
@Muennighoff Muennighoff changed the title Cannot close SpawnProcess for multiprocessing Cannot close SpawnProcess for multiprocessing model.stop_multi_process() Aug 4, 2022
@nreimers
Copy link
Member

nreimers commented Aug 4, 2022

Maybe it just exist when you use fork as method to start new processes?

@Muennighoff
Copy link
Contributor Author

Yeah I think so. I fixed it by just removing the close() line and all works fine.
I'm not sure why exactly close doesn't exist for spawn, as the docs don't mention it.

@ajdaling
Copy link

ajdaling commented Sep 9, 2022

I just ran into the same issue. Not sure what the issue is but I removed p.close() on line 237 in SentenceTransformer.py, as suggested, and that worked for me as well. The child processes still appear close as normal and GPU memory is freed.

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

3 participants