An error is reported when debugging the train file.
The location of the error appears in another file:
Most of the comments on the Internet are coding errors, and an error is reported when reading the csv, but I did not read the csv file at all, and the error was reported on the first line of the train file. First rule out whether Chinese appears in the code. plus:
# -*- coding: utf-8 -*-
Then I still reported an error, and finally found a solution, CUDA is not initialized, add at the beginning of the train file:
import torch
torch.cuda._initialized = True