It seems an indexing operation is creating an out of bounds error.
You could try to run the code on the CPU, which would error directly in the offending line of code or rerun your script with CUDA_LAUNCH_BLOCKING=1 python script.pt args, which should make sure the stack trace points to the right line of code where the indexing is failing.