Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法使用gpu训练 #58

Closed
Tingting-Liu-star opened this issue Nov 23, 2021 · 4 comments
Closed

无法使用gpu训练 #58

Tingting-Liu-star opened this issue Nov 23, 2021 · 4 comments

Comments

@Tingting-Liu-star
Copy link

python main.py -m KGCN -d LastFM4KGCN -t recommendation -g 0 --use_best_config

RuntimeError: Tensor for argument #2 'mat1' is on CPU, but expected it to be on GPU (while checking arguments for addmm)

@guyuisland
Copy link
Contributor

我这边尝试跑了一遍,没有出现您所说的这个问题,能否提供更多的报错信息好让我们处理这个问题?

@Tingting-Liu-star
Copy link
Author

(openhgnn) aaa@ubuntu:~/all_data/OpenHGNN$ python main.py -m KGCN -d LastFM4KGCN -t recommendation -g 0 --use_best_config
Using backend: pytorch
Use the best config.
Model:KGCN
Task:recommendation
Dataset:LastFM4KGCN
Done saving data into cached files.
Done saving data into cached files.
Traceback (most recent call last):
File "main.py", line 26, in
OpenHGNN(args=config)
File "/home/aaa/all_data/OpenHGNN/openhgnn/start.py", line 20, in OpenHGNN
result = flow.train()
File "/home/aaa/all_data/OpenHGNN/openhgnn/trainerflow/kgcn_trainer.py", line 67, in train
self._mini_train_step()
File "/home/aaa/all_data/OpenHGNN/openhgnn/trainerflow/kgcn_trainer.py", line 86, in _mini_train_step
self.labels, self.scores = self.model(block, inputData)
File "/home/aaa/anaconda3/envs/openhgnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/aaa/all_data/OpenHGNN/openhgnn/models/KGCN.py", line 122, in forward
self.item_embeddings, self.userList,self.labelList = self.Aggregate(blocks, inputdata)
File "/home/aaa/anaconda3/envs/openhgnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/aaa/all_data/OpenHGNN/openhgnn/models/KGCN.py", line 193, in forward
self.aggregate()
File "/home/aaa/all_data/OpenHGNN/openhgnn/models/KGCN.py", line 159, in aggregate
self.item_embeddings = th.tanh(self.agg(output))
File "/home/aaa/anaconda3/envs/openhgnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/aaa/anaconda3/envs/openhgnn/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 93, in forward
return F.linear(input, self.weight, self.bias)
File "/home/aaa/anaconda3/envs/openhgnn/lib/python3.7/site-packages/torch/nn/functional.py", line 1690, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: Tensor for argument #2 'mat1' is on CPU, but expected it to be on GPU (while checking arguments for addmm)

@Theheavens
Copy link
Member

我也尝试运行了一遍,并没有复现出这个bug,请问您是否按照我们提供的安装步骤完成或者有修改过代码吗

@Tingting-Liu-star
Copy link
Author

感谢,我重新配置了环境,问题已解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants