Your locally installed CUDA toolkit won’t be used unless you build PyTorch from source or a custom CUDA extension, since the PyTorch binaries ship with their own CUDA runtime dependencies. You can thus select any PyTorch binary with CUDA 12.x and I would recommend using the latest one (12.4.1).