lcswillems/rl-starter-files

Multiprocessing error without if-clause protection on Windows

TheNeeloy opened this issue · 2 comments

Hi,

I came across an issue when training & evaluating a model on Windows 10. Specifically, if the code in train.py, evaluate,py, and visualize.py is not wrapped in some form of a main function, which is then called with if __name__ == '__main__': main(), then the code will be run multiple times and until a multiprocessing runtime error occurs.

This can be solved, as stated in the Pytorch doc here, by wrapping the code in a function, and calling it when needed.

Wasn't sure if you wanted to address the issue as I don't know how the added code will impact Linux & Mac users, but wanted to give you a heads up that this issue exists for Windows users.

Thanks a lot @TheNeeloy for raising this issue! I didn't know it on Windows and I don't know what will be the consequence on Linux/Mac.
If somebody is willing to do a PR for this, it would be much appreciated!

This PR should have fixed this issue. Let me know if it didn'