This error is sometimes raised by a wrong usage of multiprocessing and CUDA, but this doesn’t seem to be the case here.
What does torch.cuda.is_available() return, which PyTorch and CUDA runtime versions are you using, and which GPU?