ERROR

[DL] RuntimeError: DataLoader worker (pid(s) 106594, 106595) exited unexpectedly

파송송 2023. 4. 25. 12:58
728x90

실제로 CPU만 사용하고 "fork" 대신 "spawn"을 사용하거나 num_work가 0이 아닐 때 생기는 에러이다.

https://github.com/pytorch/pytorch/issues/5301

 

Runtime Error with DataLoader: exited unexpectedly · Issue #5301 · pytorch/pytorch

Hi All, I have a DataLoader that loads a line from a file with Numpy, then convert it to a torch Tensor, and whenever I run this with more than 1 workers, it gives me an error: RuntimeError: DataLo...

github.com

self.dataloader = DataLoader(
            dataset=self.dataset,
            batch_size=self.batchsize,
            shuffle=True,
            num_workers=self.num_workers,
            generator=torch.Generator(device='cuda')
        )

num_workers를 0으로 바꿔주니 해결됐다

728x90