According to this link, you need to install the latest CUDA to make the GPU accessible.
So follow the official instruction to install CUDA 12.8, and install pytorch-nightly later:
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128
Finally something that works. Thanks a lot!