Cuda Out of Memory: Implementing a Paper

I have an M1 Mac, and I cannot use Cuda properly. I have used Kaggle for this purpose. I am trying to implement this paper:

I am constantly getting the error:

Traceback (most recent call last):
File “”, line 135, in
File “”, line 131, in main
File “/kaggle/working/1R2GenCMN/modules/”, line 58, in train
result = self._train_epoch(epoch)
File “/kaggle/working/1R2GenCMN/modules/”, line 184, in _train_epoch
File “/opt/conda/lib/python3.7/site-packages/torch/”, line 363, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File “/opt/conda/lib/python3.7/site-packages/torch/autograd/”, line 175, in backward
allow_unreachable=True, accumulate_grad=True) # Calls into the C++ engine to run the backward pass
RuntimeError: CUDA out of memory. Tried to allocate 6.12 GiB (GPU 0; 14.76 GiB total capacity; 4.51 GiB already allocated; 5.53 GiB free; 8.17 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

How to solve this in Kaggle?