", line 1, in runfile('D:/Pytorch Learning/mofan_code/optimizer.py', wdir='D:/Pytorch Learning/mofan..._raise runtimeerror('dataloader worker (pid(s) {}) exited unexpectedly">
当前位置:   article > 正文

RuntimeError: DataLoader worker (pid(s) 13952, 14260) exited unexpectedly 解决办法_raise runtimeerror('dataloader worker (pid(s) {})

raise runtimeerror('dataloader worker (pid(s) {}) exited unexpectedly'.forma

Traceback (most recent call last):

  File "<ipython-input-48-37d70fab5553>", line 1, in <module>
    runfile('D:/Pytorch Learning/mofan_code/optimizer.py', wdir='D:/Pytorch Learning/mofan_code')

  File "C:\anconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

  File "C:\anconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/Pytorch Learning/mofan_code/optimizer.py", line 65, in <module>
    for step, (batch_x, batch_y) in enumerate(loader):# for each training step

  File "C:\anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 576, in __next__
    idx, batch = self._get_batch()

  File "C:\anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 553, in _get_batch
    success, data = self._try_get_batch()

  File "C:\anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 519, in _try_get_batch
    raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))

RuntimeError: DataLoader worker (pid(s) 8524, 13912) exited unexpectedly

 

解决办法:num_workers=2, # subprocesses for loading data

注释子进程即可# num_workers=2

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/562763
推荐阅读
相关标签