lanyunshi/Multi-hopComplexKBQA

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

2213500360 opened this issue · 3 comments

File "C:\Users\Multi-hopComplexKBQA-master\code\BertModel.py", line 185, in forward
attention_scores = attention_scores + attention_mask
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

How to fix it?

how did you solve this problem?

how did you solve this problem?

The reason for this problem maybe is that the value of gpu_id is 0. You can change "gpu_id" to another value, such as 1. Or change all "args.gpu_id! = 0" in KBQA_ Runner.py after "if " to "args.gpu_ id==0" .

thanks a lot!!!