Good day,
I want to test the model on windows 10. I assume the code was written for Linux, therefore I am receiving problems related to pip. I found that I should add "if name == 'main':" to protect the main code, however, I wasn't successful in fixing this problem.
Could someone help to solve this issue?
Solution:
https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing/18205006#18205006
explenation:
https://stackoverflow.com/questions/14207708/ioerror-errno-32-broken-pipe-python
Error:
BrokenPipeError Traceback (most recent call last)
in ()
4
5 for epoch in range(n_epochs):
----> 6 for batch_id, sample_batch in enumerate(train_loader):
7
8 inputs = Variable(sample_batch)
~\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in iter(self)
308
309 def iter(self):
--> 310 return DataLoaderIter(self)
311
312 def len(self):
~\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in init(self, loader)
165 for w in self.workers:
166 w.daemon = True # ensure that the worker exits on process exit
--> 167 w.start()
168
169 if self.pin_memory:
~\Anaconda3\lib\multiprocessing\process.py in start(self)
103 'daemonic processes are not allowed to have children'
104 _cleanup()
--> 105 self._popen = self._Popen(self)
106 self._sentinel = self._popen.sentinel
107 # Avoid a refcycle if the target function holds an indirect
~\Anaconda3\lib\multiprocessing\context.py in _Popen(process_obj)
221 @staticmethod
222 def _Popen(process_obj):
--> 223 return _default_context.get_context().Process._Popen(process_obj)
224
225 class DefaultContext(BaseContext):
~\Anaconda3\lib\multiprocessing\context.py in _Popen(process_obj)
320 def _Popen(process_obj):
321 from .popen_spawn_win32 import Popen
--> 322 return Popen(process_obj)
323
324 class SpawnContext(BaseContext):
~\Anaconda3\lib\multiprocessing\popen_spawn_win32.py in init(self, process_obj)
63 try:
64 reduction.dump(prep_data, to_child)
---> 65 reduction.dump(process_obj, to_child)
66 finally:
67 set_spawning_popen(None)
~\Anaconda3\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
58 def dump(obj, file, protocol=None):
59 '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60 ForkingPickler(file, protocol).dump(obj)
61
62 #
BrokenPipeError: [Errno 32] Broken pipe