好文章,超级详细,但是大部分步骤用不上:

https://blog.csdn.net/qq_41315788/article/details/123579623

检查电脑里的torch是否兼容CUDA:

import torch
print(torch.cuda.is_available())

如果不行,那就运行:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

就可以了!!