Post copy/pasted from another thread (let us know if it works for you, it did for me).

It took me quite some time to figure it out. Hopefully this is useful for someone.
In my case I am using Jupyter Notebook which was causing the exact same error. I wrote a small blog post about it with code examples to a fully working PyTorch Multiprocessing with Queue.
Jupyter Notebook PyTorch Multiprocessing – Data Is Key 37
Github with just the code example:
GitHub - olympus999/jupyter-notebook-pytorch-multiprocessing-queue: A simple workaround to run Pytorch multiprocessing in Jupyter Notebook. Also showing performance difference between normal Queue (not sharing memory) and Pytorch queue (sharing memory). 18