pytorch报错RuntimeError: DataLoader worker (pid(s) xxx) 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的时候没装上吧。

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2020.6.20          |           py36_0         160 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-base-1.18.5          |   py36hde5b4d6_0         5.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_random-1.1.1           |   py36h0573a6f_0         382 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mkl_fft-1.1.0              |   py36h23d657b_0         159 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    numpy-1.18.5               |   py36ha1c710e_0           4 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:         5.8 MB

The following NEW packages will be INSTALLED:

    blas:           1.0-mkl                               https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    cudatoolkit:    10.1.243-h6bb024c_0                   https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    intel-openmp:   2020.1-217                            https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    libgfortran-ng: 7.3.0-hdf63c60_0                      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    mkl:            2020.1-217                            https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    mkl-service:    2.3.0-py36he904b0f_0                  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    mkl_fft:        1.1.0-py36h23d657b_0                  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    mkl_random:     1.1.1-py36h0573a6f_0                  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    ninja:          1.9.0-py36hfd86e86_0                  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    numpy:          1.18.5-py36ha1c710e_0                 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    numpy-base:     1.18.5-py36hde5b4d6_0                 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main    
    pytorch:        1.4.0-py3.6_cuda10.1.243_cudnn7.6.3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
    six:            1.15.0-py_0                           https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ```

  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Wanderer001

ROIAlign原理

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值