Pytorch報錯記錄


1.BrokenPipeError

 執行以下命令時:

 a,b = iter(train_loader).next()

報錯:BrokenPipeError: [Errno 32] Broken pipe

錯誤原因:子進程原因

On Windows the subprocesses will import (i.e. execute) the main module at start. You need to insert an if __name__ == '__main__': guard in the main module to avoid creating subprocesses recursively.
解決方法:

Please see my edited response where I did exactly that. The requirement for wrapping the code inside of if __name__ == '__main__' code isn't immediately obvoius, as it is only required for Windows machines.就是說在windows下必須將上面的代碼打包在if __name__ == '__main__'語句下面。這時不會報錯了。

還有人說:I also got the same error. When I set num_workers to 0, the error does not appear again. However, when I set num_workers to 1, the error is still there.即將如下:

    train_loader = data.DataLoader(dataset, batch_size=64, shuffle=True, num_workers=2, drop_last=False)

代碼中的num_workers=0,但我改了以后還回報另外的錯誤。

 

2. 發現gpu並行運算出錯,單個gpu沒問題.

重新裝了驅動:ubuntu18.04-rtx2080ti-nvidia driver 410.78-cuda9.0-cudnn-9.0-v7.5.1.10-將gcc和g++降級為4.8.

 

3.  CUDA,CUDNN工具箱多版本安裝、多版本切換


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM