自己的dataset的__getitem__使用my_interp,出现re-initialize CUDA in forked subproces的问题
578223592 opened this issue · comments
思无邪 commented
尝试在自己的数据集上使用my_interp
,但是发现因为my_interp
要求数据都必须在cuda上,而在__getitem__
方法中使用data.cuda()
会出现:
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method
的问题。
想请教一下有没有处理的方法。
已经参考过issue:#53
这个出现原因是因为dataset固有的一些限制,没有找到特别好的解决方法
https://discuss.pytorch.org/t/runtimeerror-caught-runtimeerror-in-dataloader-worker-process-0/167037/6
https://pytorch.org/docs/stable/notes/multiprocessing.html#cuda-in-multiprocessing