divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.84k stars 281 forks source link

AttributeError: 'GCNConv' object has no attribute 'lin' when using GCN_2l #123

Closed matekenya closed 2 years ago

matekenya commented 2 years ago

I am attempting to use the predefined models in the framework to perform a classification task and explanation on graphs. Upon initializing the models, using;

model = GCN_2l(model_level='graph', dim_node=num_node_features, dim_hidden=64, num_classes=num_classes)

The following error comes up. AttributeError: 'GCNConv' object has no attribute 'lin'

Previously I was met with the error AttributeError: 'GCNConv' object has no attribute 'weight' when I ran the following; explainer = SubgraphX(model=model_gcn_2l, num_classes=num_classes, device=device, explain_graph=True) explainer(x, edge_index)

It was recommended that I change my torch_geometric version to 1.7.2, which I did now, I am meeting this error AttributeError: 'GCNConv' object has no attribute 'lin' when initializing the model.

image
CM-BF commented 2 years ago

Hi, we have updated our version to support PyG 2.0.x. If you are using the dig-stable branch, you can use PyG 2.0.x. Sorry for the inconvenience, the incompatibility of PyG is a troublesome problem. You may refer to https://github.com/divelab/DIG/blob/dig-stable/examples/xgraph/gnnexplainer.ipynb.

matekenya commented 2 years ago

This is helpful, thanks.