You might be running out of memory, so could reduce the batch size and rerun the code.
If that doesn’t help, could you post an executable code snippet as well as the output of python -m torch.utils.collect_env?