RuntimeError: DataLoader worker (pid(s) 29167) exited unexpectedly

@Pytorch| RuntimeError: DataLoader worker (pid(s) 29167) exited unexpectedly

RuntimeError: DataLoader worker (pid(s) 29167) exited unexpectedly

使用pytorch多线程进行测试时,出现上述问题,我的环境是pytorch+anaconda+pycharm;

出现这种问题的可能原因:cuda 虚拟环境的共享内存不足

解决办法:
1、改成更小的batchsize;
2、在dataloader中将numworkers 注释掉,不用多进程,如下

 test_loader = DataLoader(dataset,batch_size = 1,shuffle = False,num_workers = args.workers,
 collate_fn = data.collate,pin_memory=False)

改成:

 test_loader = DataLoader(dataset,batch_size=1,shuffle=False,collate_fn=data.collate,pin_memory=False)

即可解决问题。

你可能感兴趣的:(深度学习,pytorch,anaconda)