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

AttributeError: 'GCNConv' object has no attribute '__explain__' #153

Closed
cxw-droid opened this issue Sep 15, 2022 · 5 comments
Closed

AttributeError: 'GCNConv' object has no attribute '__explain__' #153

cxw-droid opened this issue Sep 15, 2022 · 5 comments

Comments

@cxw-droid
Copy link

Hi,

There is an error when I tried to train a new model for PGExplainer:
$ /bin/bash ./models/train_gnns.sh:

AttributeError: 'GCNConv' object has no attribute '__explain__'

The error is from here

if self.__explain__:

Could you please take a look at this issue? Thanks.

@Oceanusity
Copy link
Collaborator

Could you provide your pytorch_geometric version? If your pyg version is higher than 1.6, the MessgaPassing class does not contain the __explain__ variable. For the main branch, they use pytorch_geometric==1.6.0.

@cxw-droid
Copy link
Author

Thank you for your reply. I changed pyg to 1.6, it works. But when I ran pipeline.py, it output error here

dataset = get_dataset(data_args)

self.data, self.slices = torch.load(self.processed_paths[0])

AttributeError: Can't get attribute 'DataEdgeAttr' on <module 'torch_geometric.data.data'

It seems I need another pyg version then?

@cxw-droid
Copy link
Author

cxw-droid commented Oct 3, 2022

I found the reason. pipeline.py and train_gnns.py use different datasets directories. After removing the BA_shapes/processed directory used by pipeline.py, which was generated by a different pyg package, the code pipeline.py works.

@CM-BF
Copy link
Collaborator

CM-BF commented Oct 7, 2022

After removing the BA_shapes/processed directory used by pipeline.py, which was generated by a different pyg package, the code pipeline.py works.

The new PyG data structure is different to the older one, which causes many problems. I highly encourage you to use the dig-stable branch with PyG version 2.X.

And you may need to notice that PyG makes changes for its explanation parts frequently. It is a good idea to stick to a specific PyG version.

Please let me know if any questions!

@cxw-droid
Copy link
Author

Thank you for the update. I used the main branch because I found PGExplainer code there.

Currently there is no instructions how to run the method/pgexplainer.py code in the dig-stable branch. Although I noticed there is pgexpainer.ipynb under examples, sometimes it would be helpful to run the py code directly. Thanks.

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