The CPU I used before, but now I have such a problem with the GPU, I found a solution from other bloggers, for example:
Check if CUDA and pytorch are compatible
Return True, Compatible
It should be a code problem, search for device
set device='0'
start training