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
2213500360 commented
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?
novice7 commented
how did you solve this problem?
2213500360 commented
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" .
novice7 commented
thanks a lot!!!