[How to Solve Pytorch Error] EOFError: Ran out of input

The specific errors encountered in training models with pytorch under windows are as follows.

Traceback (most recent call last):
File “train.py”, line 49, in <module>
data_loader_iter = iter(data_loader)
File “D:\anaconda3\lib\site-packages\torch\utils\data\dataloader.py”, line 501
, in __iter__
return _DataLoaderIter(self)
File “D:\anaconda3\lib\site-packages\torch\utils\data\dataloader.py”, line 289
, in __init__
File “D:\anaconda3\lib\multiprocessing\process.py”, line 105, in start
self._popen = self._Popen(self)
File “D:\anaconda3\lib\multiprocessing\context.py”, line 212, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File “D:\anaconda3\lib\multiprocessing\context.py”, line 313, in _Popen
return Popen(process_obj)
File “D:\anaconda3\lib\multiprocessing\popen_spawn_win32.py”, line 66, in __in
reduction.dump(process_obj, to_child)
File “D:\anaconda3\lib\multiprocessing\reduction.py”, line 59, in dump
ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can’t pickle <function <lambda> at 0x000000001BD9E048>: a
ttribute lookup <lambda> on __main__ failed
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “D:\anaconda3\lib\multiprocessing\spawn.py”, line 106, in spawn_main
exitcode = _main(fd)
File “D:\anaconda3\lib\multiprocessing\spawn.py”, line 116, in _main
self = pickle.load(from_parent)
EOFError: Ran out of input

This error is actually a pytorch function torch.utils.data.DataLoader in the windows-specific error, the function has a parameter num_workers to indicate the number of processes, in windows to change to 0 can be.


Similar Posts: