Pytorch Windows EOFError: Ran out of input when num_workers>0


runs in spyder IDE on windows 10, but pycharm 2021.2.1:

  File "C\anaconda3\envs\pycharm\lib\multiprocessing\", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <class '__main__.dataset3D'>: attribute lookup dataset3D on __main__ failed
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "\anaconda3\envs\pycharm\lib\multiprocessing\", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "\anaconda3\envs\pycharm\lib\multiprocessing\", line 126, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input

strangely enough it will run if pycharm is in debug mode…

Thank you so much, this worked for me.