CUDA error from python pytorch script only on my device

Hi. I am facing a confusing issue with CUDA when running pytorch scripts. I tried running several different python scripts which use CUDA on my new laptop with a NVIDIA RTX GeForce 4080 GPU and I keep getting slightly different CUDA errors each time I run the scripts. I removed any random elements from the code but each time I run it, the error behaves slightly differently, sometimes taking longer to error for example. I know for a fact the code works in all the scripts as I have seen them run properly on different devices, and they work fine if I run them on my CPU. Here is a link to a pytorch forum post I made about this which goes into further detail on the code and error messages.

I am quite confident the issue is with CUDA or the GPU as my scripts works perfectly on CUDA on other devices, or the CPU on my device, and I tried using different pytorch versions but get the same result.

My knowledge outside python and pytorch is quite limited so any advice on debugging or finding the source of the error is appreciated. Thanks

hi @erik3papp ,
I see our Engineer are working with you on git. Marking this issue as duplicate of CUDA error: device-side assert triggered only on my device, but code works on other devices - nlp - PyTorch Forums