KEQA_WSDM19
KEQA_WSDM19 copied to clipboard
TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first
I had error in this lines of code. The error is TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Can you help me? Thank you
I met this problem too, when training predicates ..
You should make sure that, you either run on GPU and put all the data on GPU, or run on CPU and put all the data on CPU.
Hi @xhuang31 ,
I met the issue too, but I don't understand what you mean. "run on GPU and put all the data on GPU"<-- What does the "data" in sentence mean? I just run "python3.6 train_pred.py --qa_mode GRU --fix_embed --gpu 0" in my docker environment. Is there any config I should set?
Thx
===Updated===
I sovle this issue by modifying the line 214 of train_pred.py.
learned_pred = euclidean_distances(answer.cpu().data.numpy(), predicates_emb.cpu().numpy()).argmin(axis=1)
Then, It can work now. Thx again.
I met this problem too, when training predicates ..
Hello, I'm also studying this paper recently. Can I have some questions to communicate with you? If it's convenient
I met this problem too, when training predicates ..
Hello, I'm also studying this paper recently. Can I have some questions to communicate with you? If it's convenient
Hi, I am not working on this topic anymore. I also failed to use the code in this repo for experiments.
ok,thank you ------------------ 原始邮件 ------------------ 发件人: "xhuang31/KEQA_WSDM19" @.>; 发送时间: 2021年10月21日(星期四) 下午4:17 @.>; 抄送: "硬币 @.@.>; 主题: Re: [xhuang31/KEQA_WSDM19] TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first (#14)
I met this problem too, when training predicates ..
Hello, I'm also studying this paper recently. Can I have some questions to communicate with you? If it's convenient
Hi, I am not working on this topic anymore. I also failed to use the code in this repo for experiments.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.