DSE-MSU / DeepRobust

A pytorch adversarial library for attack and defense methods on images and graphs
MIT License
994 stars 192 forks source link

[Maybe bug] Dpr2Pyg doesn't seem to function properly. #93

Closed NiceTryAndGG closed 2 years ago

NiceTryAndGG commented 2 years ago

I tried the three examples, test-gat.py, test-chebnet.py, test-sgc.py. All of them didn't work out well. I didn't make any changes to the original codes. Some of the possibly needed environment information are as follow: torch-geometric 2.0.3 torch 1.9.0 deeprobust 0.2.4

Thanks for reading. And the logs are as follow, if it might be of some help:

gat:

cuda: True Loading cora dataset... Selecting 1 largest connected components === train on clean graph === Processing... Done! Traceback (most recent call last): File "", line 34, in sgc.fit(pyg_data, verbose=True) # train with earlystopping File "/python/lib/python3.9/site-packages/deeprobust/graph/defense/sgc.py", line 104, in fit self.data = pyg_data[0].to(self.device) File "/python/lib/python3.9/site-packages/torch_geometric/data/dataset.py", line 198, in getitem data = self.get(self.indices()[idx]) File "/python/lib/python3.9/site-packages/deeprobust/graph/data/pyg_dataset.py", line 83, in get item, slices = self.data[key], self.slices[key] TypeError: 'NoneType' object is not subscriptable

Process finished with exit code 1

chebnet:

cuda: True Loading cora dataset... Selecting 1 largest connected components === train on clean graph === Processing... Done! Traceback (most recent call last): File "", line 34, in cheby.fit(pyg_data, verbose=True) # train with earlystopping File "/python/lib/python3.9/site-packages/deeprobust/graph/defense/chebnet.py", line 116, in fit self.device = self.conv1.weight.device File "/python/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'ChebConv' object has no attribute 'weight'

Process finished with exit code 1

sgc:

cuda: True Loading cora dataset... Selecting 1 largest connected components === train on clean graph === Processing... Done! Traceback (most recent call last): File "", line 34, in sgc.fit(pyg_data, verbose=True) # train with earlystopping File "/python/lib/python3.9/site-packages/deeprobust/graph/defense/sgc.py", line 104, in fit self.data = pyg_data[0].to(self.device) File "/python/lib/python3.9/site-packages/torch_geometric/data/dataset.py", line 198, in getitem data = self.get(self.indices()[idx]) File "/python/lib/python3.9/site-packages/deeprobust/graph/data/pyg_dataset.py", line 83, in get item, slices = self.data[key], self.slices[key] TypeError: 'NoneType' object is not subscriptable

Process finished with exit code 1

EdisonLeeeee commented 2 years ago

This is a problem caused by some recent updates to the torch_geometric, maybe you should use a lower version such as 2.0.0

NiceTryAndGG commented 2 years ago

This is a problem caused by some recent updates to the torch_geometric, maybe you should use a lower version such as 2.0.0

Version 1.7.2 solves the problem. Thanks for your reply.