Difference between setting num_workers>0 in fastai & pytorch


I’d like to understand the difference between setting num_workers>0 in fastai and pytorch

Unfortunately I’m stuck to using Windows. When I set num_workers>0 in pytorch, I see no improvement in terms of the time taken to train the model

However, fastai, I believe, by default, uses maximum number of processors available. I observe that my CPU usage is always high (around 80%) and my training is much more faster

I’d like to know what happens behind the scenes in fastai library (w.r.t number of workers) and in pytorch. Is there a difference? Does fastai do something different as compared to pytorch

Thank you!

You need to set num_workers=0 on windows. What you should notice is that the long pause between epochs when nothing appears to be happening will magically disappear.

There are threads here on the underlying pytorch issue if you search around. It is specific to windows.

Yes, I’ve looked at those. I am interested in knowing how fastai gets it working - since its built on top of pytorch.

I am actually interested in a similar question. How to restrict the number of CPUs used during training? I work on a shared Linux number-cruncher where all others get problems when I start training and jupyter sometimes crashes.
Thanks :+1:

To reply to oneself is always the best outcome :-).
For anybody interested:
restricts the number of CPUs used for training and inference