PyTorch does not yet offer official support for CUDA 12.8 in its stable releases. You may need to wait for native support or consider installing WSL.
Reference: https://discuss.pytorch.org/t/how-to-install-torch-version-that-supports-rtx-5090-on-windows-cuda-kernel-errors-might-be-asynchronously-reported-at-some-other-api-call/216644