Could you check the memory usage via nvidia-smi and make sure the device is empty and stop other processes, if necessary?
I haven’t tried the code, so I’m not sure how large the expected memory footprint is.