This error message:
RuntimeError: CUDA out of memory. Tried to allocate 2.00 MiB (GPU 0; 8.00 GiB total capacity; 1.48 GiB already allocated; 0 bytes free; 2.90 GiB reserved in total by PyTorch)

suggests, that other processes are using the GPU and are allocating memory.
You can check it via nvidia-smi and see, how much memory is used before running your script.