RuntimeError: DataLoader worker (pid 5657)

RuntimeError: DataLoader worker (pid 5657) is killed by signal: Killed. Details are lost due to multiprocessing. Rerunning with num_workers=0 may give better error trace.

I encountered into the following problem when I was trying to read a batch (32)of relatively large data sample with multi-threaded DataLoader (with num_workers=8 for example).
I have tried increasing the shared memory of ubuntu but did not work.
It will run without the num_workers argument, but it is too slow to learn from a large data set with single thread.

参考了一些答案后  改成num-worker为4  batch-size为20

In my case, I find that it caused by out of memory of machine(note that , not GPU memory). To test that when run your code, you can use command top to see the whether the memory and swap memory are used up. If so , it is the memory problem. You can use a small batch, use a small num_workers, expand your swap memory,etc. Any way could decrease your memory load would be helpful.

RuntimeError: DataLoader worker (pid 5657)_第1张图片

 

你可能感兴趣的:(RuntimeError: DataLoader worker (pid 5657))