I read a lot on the Internet about the multiprocessor problem with using Dataloader in Windows.
The solutions are here:
1-use if clause to cover for data loader loop.
2-use pickle version 4.
3-set DEFAULT_PROTOCOL in pickle to 4
4-set num_worker=0
For the solution #1,2,3:
The problem persist again after changes.
For the solution #4:
Code executed but it’s very slow due to num_worker=0
I check the multiprocessing problem in windows with bellow minimal famous code:
from multiprocessing import Process, freeze_support
def foo():
print (‘hello’)
if name == ‘main’:
freeze_support()
p = Process(target=foo)
p.start()
after execution this error occurred.
Traceback (most recent call last):
File “”, line 1, in 
File “D:\ProgramData\Anaconda3\envs\Torki\lib\multiprocessing\spawn.py”, line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File “D:\ProgramData\Anaconda3\envs\Torki\lib\multiprocessing\spawn.py”, line 126, in _main
self = reduction.pickle.load(from_parent)
AttributeError: Can’t get attribute ‘foo’ on <module ‘main’ (built-in)>
OS: Windows 10
anaconda
torch version= 1.9
pickle version=4
can anyone help me?

ptrblck