zhao-tong / GAug

AAAI'21: Data Augmentation for Graph Neural Networks
MIT License
185 stars 33 forks source link

Bug with new versions #4

Closed Ripper346 closed 3 years ago

Ripper346 commented 3 years ago

Hi, I am trying to run your code on python 3.8.8 and newest libraries of DGL on Windows. However, there are a lot of problems with devices.

If I run, for example, python .\train_AdaEdge.py --dataset cora --gnn gcn --gpu 0, I get

dgl._ffi.base.DGLError: Cannot assign node feature "norm" on device cuda:0 to a graph on device cpu. Call DGLGraph.to() to copy the graph to the same device.

even if I start with gpu -1. That is on rows 75 and 85 of GCN_dgl.py and if I remove them as you do to device of graph in the constructor, I get

File "C:\Users\alessandro\Developments\graph-cluster-crossover-similarity\other_augmentation\GAug-master\models\GCN_dgl.py", line 205, in forward
    h = h * g.ndata['norm']
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

I think that they put a more strict regulation of devices in DGL but I don't really know well the library. Do you plan to update it or I absolutely need to use the versions of requirements file?

I also think that it is a bug that I can't use it without gpu.

zhao-tong commented 3 years ago

Hi, thanks for the notice! Yeah I think the way I added the normalization in gcn is no longer supported in the newer versions of DGL. For now I would recommend you to use dgl==0.4.2 as specified in requirements.txt when running these codes, as I'm not sure if I can find a solution to make it also work with newer versions of DGL.

ghsticker commented 1 year ago

I also encountered this problem, I put graph g on GPU device slove problem.Like file GCN_DGl line 69 self.G = DGLGraph(self.adj).to(self.device)