当前位置:   article > 正文

pytorch报错RuntimeError: DataLoader worker (pid(s) xxx) exited unexpectedly_runtimeerror: dataloader worker (pid(s) 3820) exit

runtimeerror: dataloader worker (pid(s) 3820) exited unexpectedly

参考pytorch报错RuntimeError: DataLoader worker (pid(s) xxx) exited unexpectedly - 云+社区 - 腾讯云

报错

pytorch报错RuntimeError:
DataLoader worker (pid(s) ... exited unexpectedly

解决

因为torch.utils.data.DataLoader中设置了num_works=4,也就是多线程读取。

根据其他方法,我设置num_works=1或者num_works=0都不行。

最后重装了pytorch,就可以了。

pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html

原因分析

过程中显示下面内容,所以,可能是因为有些包用pip install的时候没装上吧。

  1. The following packages will be downloaded:
  2. package | build
  3. ---------------------------|-----------------
  4. certifi-2020.6.20 | py36_0 160 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  5. numpy-base-1.18.5 | py36hde5b4d6_0 5.1 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  6. mkl_random-1.1.1 | py36h0573a6f_0 382 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  7. mkl_fft-1.1.0 | py36h23d657b_0 159 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  8. numpy-1.18.5 | py36ha1c710e_0 4 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  9. ------------------------------------------------------------
  10. Total: 5.8 MB
  11. The following NEW packages will be INSTALLED:
  12. blas: 1.0-mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  13. cudatoolkit: 10.1.243-h6bb024c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  14. intel-openmp: 2020.1-217 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  15. libgfortran-ng: 7.3.0-hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  16. mkl: 2020.1-217 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  17. mkl-service: 2.3.0-py36he904b0f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  18. mkl_fft: 1.1.0-py36h23d657b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  19. mkl_random: 1.1.1-py36h0573a6f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  20. ninja: 1.9.0-py36hfd86e86_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  21. numpy: 1.18.5-py36ha1c710e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  22. numpy-base: 1.18.5-py36hde5b4d6_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  23. pytorch: 1.4.0-py3.6_cuda10.1.243_cudnn7.6.3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
  24. six: 1.15.0-py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  25. ```

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

闽ICP备14008679号