deepsnap
deepsnap copied to clipboard
Converting PyG 2.4.0 dataset to a list of deepsnap graphs no longer works!
Hello,
After upgrading from PyG 2.3.x to PyG 2.4.0, the keys
property of torch_geometric.data.data.BaseData
was refactored into a method, leading to the following error when calling GraphDataset.pyg_to_graphs
File [.../lib/python3.10/site-packages/deepsnap/dataset.py:1277](https://file+.vscode-resource.vscode-cdn.net/.../lib/python3.10/site-packages/deepsnap/dataset.py:1277), in <listcomp>(.0)
1274 return graphs_split
1275 else:
1276 return [
...
1975 data.edge_attr if "edge_attr" in data.keys else None
1976 )
1977 kwargs["node_label"], kwargs["edge_label"] = None, None
TypeError: argument of type 'method' is not iterable
You can use this sample to replicate the issue:
from deepsnap.dataset import GraphDataset
from torch_geometric.datasets import Planetoid
root = './tmp/cora'
name = 'Cora'
pyg_dataset= Planetoid(root, name)
graphs = GraphDataset.pyg_to_graphs(pyg_dataset)
Could someone please have a look?
Thank you in advance!
Sebastian
I ended up solving the issue in a deepsnap forked repo!
Thanks @SebastianHurubaru ! Sorry that I am very busy recently. If possible, can you also create a PR for the fix?
@zechengz thanks for your reply. No worries! I made this PR. Please be aware that with the fix I have done, the new release will be compatible with PyG 2.4.x + only, so for older releases of PyG you will now get a similar issue.
Let me know if you have any questions please!