pykt-toolkit icon indicating copy to clipboard operation
pykt-toolkit copied to clipboard

DKT-F:Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Open WinterGan opened this issue 1 year ago • 5 comments

Hi , I am currently working with DKT-F and encountered the following error: "Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!"

WinterGan avatar Dec 11 '23 02:12 WinterGan

Hi , I am currently working with DKT-F and encountered the following error: "Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!"

Hi, this issue is caused by the tensors are not on the same device. Could u provide more details about your errors?Such as which line did the error occur?

sonyawong avatar Dec 11 '23 04:12 sonyawong

Hi , I am currently working with DKT-F and encountered the following error: "Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!"

Hi, this issue is caused by the tensors are not on the same device. Could u provide more details about your errors?Such as which line did the error occur?

File "/home/gzd/Desktop/pykt-toolkit/pykt/models/dkt_forget.py", line 56, in forward rgap, sgap, pcount = self.rgap_eye[rgap].to(device), self.sgap_eye[sgap].to(device), self.pcount_eye[pcount].to(device)

WinterGan avatar Dec 11 '23 07:12 WinterGan

.rgap_eye[rgap].to(device), self.sgap_eye[sgap].to(device), self.pcount_eye[pcount].to(device)

The tensors of self.rgap_eye, self.sgap_eye and self.pcount_eye are not on GPUs. The following codes may work.

self.rgap_eye = torch.eye(num_rgap) --> self.rgap_eye = torch.eye(num_rgap).to(device) self.sgap_eye = torch.eye(num_sgap) --> self.sgap_eye = torch.eye(num_sgap).to(device) self.pcount_eye = torch.eye(num_pcount) --> self.pcount_eye = torch.eye(num_pcount).to(device)

sonyawong avatar Dec 12 '23 06:12 sonyawong

您好,我运行最新的sparseKT模型,也遇到了类似的错误,而且报错的行很多。 image

xiangxin-oss avatar Dec 26 '23 09:12 xiangxin-oss

您好,我运行最新的sparseKT模型,也遇到了类似的错误,而且报错的行很多。 image

您好,我也遇到了您同样的情况,请问您解决了么?

henrywang777 avatar Sep 02 '24 06:09 henrywang777