This error indicates that you are running out of memory on your GPU so you would still need to reduce the memory usage e.g. by lowering the batch size or by using torch.utils.checkpoint to trade compute for memory.