Repository navigation
Fixed the tutorial for Windows - #483
StijnvWijn wants to merge 1 commit into
Conversation
|
@ericspod do you have any thoughts here? I've not experience running on windows, i note none of the MONAI tutorials make use of a |
|
AFAIK the main() is not necessary for Windows in all cases, but the moment you need to use multiprocessing, like a dataloader with workers > 1, you need an if statement like this: |
|
Hmm, I think in general the tutorials are meant to give an overall example of how to run the code which users can then take and build upon locally if they want more performant versions. So it might be fine to just set workers = 1 for compatibility with windows here, rather than reconfiguring the tutorials. But I'll let eric weight in here as he has more experience with how things are done on MONAI core :) |
|
The same issues are occurring when I try to use the LDM tutorial python file, so if you want, I can make a separate PR for that one as well. |
|
@ericspod can we get your input on how we should handle these tutorials not working on windows out the box? does MONAI core have an approach? |
|
Hi @marksgraham @StijnvWijn There's two things going on here. We're generating the tutorial script files from the notebooks so they lack the The second thing is that for those tutorials or ours here in GenerativeModels the fix for notebooks is much harder, so we have said that Windows users need to use 0 workers. We haven't been consistent with putting that in the code (like here) but it's what works. Script files should be fine still, it's just notebooks that would have an issue using spawn semantics. So for us here if we're create a script file independently of a notebook we should follow what Python requires for Windows, ie. the guarded |
|
Given we have tied our scripts to our notebooks with jupytext there will be no easy way to reconfigure all of the Once we move these tutorials over to MONAI we might decouple notebooks and python files and we could fix this more generally. |
|
Hmm yeah, I also do not see a way that we can fix it right now. A workaround has been mentioned in the Jupytext issue 592, but that seems like a very hacky solution which is not really desirable. I will close this issue for now. |
The following things were changed to get it working on Windows again: