Is your code running fine on the CPU?
If you haven’t tested it yet, could you try to run it on the CPU, as some error messages will be clearer.
Also, did you run your code with CUDA_LAUNCH_BLOCKING=1 python script.py args?
Since CUDA operations are asynchronous, the stack trace might point to the wrong line of code.