LunaBlack / KGAT-pytorch

328 stars 72 forks source link

A problem that I cant run this code #9

Open BlueGhostZ opened 3 years ago

BlueGhostZ commented 3 years ago

Hello,author. When I ran your codes, there was an error: ~/notebooks/ZY/KGAT/main_kgat.py in train(args) 113 train_nodes = train_nodes.to(device) 114 train_edges = train_edges.to(device) --> 115 train_graph.ndata['id'] = train_nodes.to(device) 116 train_graph.edata['type'] = train_edges.to(device) DGLError: Cannot assign node feature "id" on device cuda:0 to a graph on device cpu. Call DGLGraph.to() to copy the graph to the same device.

Can you help me? Thank you very much.

liyy2 commented 3 years ago

I think you can resolve this by switching to a lower version of DGL.

liang-ry commented 2 years ago

Hello,author. When I ran your codes, there was an error: ~/notebooks/ZY/KGAT/main_kgat.py in train(args) 113 train_nodes = train_nodes.to(device) 114 train_edges = train_edges.to(device) --> 115 train_graph.ndata['id'] = train_nodes.to(device) 116 train_graph.edata['type'] = train_edges.to(device) DGLError: Cannot assign node feature "id" on device cuda:0 to a graph on device cpu. Call DGLGraph.to() to copy the graph to the same device.

Can you help me? Thank you very much.

I switch the version of DGL to 0.4.1 and solve the issue. Wish it help you!

San-ctuary commented 2 years ago

hello,you can move the graph to the same device with the tensor. I think this can solve you problem