Open shineyGuang opened 1 year ago
报错信息:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_CUDA__index_select) 能请您给指点一下么?
Just feed all the data and model to the same device(e.g. cuda)
将第28行改成下面: device = torch.device("cuda:0") tokens = tokenizer(prompt, return_tensors='pt', padding=True, max_length=512).to(device)
device = torch.device("cuda:0") tokens = tokenizer(prompt, return_tensors='pt', padding=True, max_length=512).to(device)
报错信息:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_CUDA__index_select) 能请您给指点一下么?