Open 22842219 opened 1 year ago
Hi @22842219, could you follow the bug report template to provide more details?
meet the same problem when using MNIST dataset at https://data.dgl.ai/dataset/benchmarking-gnns/MNIST.pkl
how to reproduce
curl https://data.dgl.ai/dataset/benchmarking-gnns/MNIST.pkl -o MNIST.pkl -J -L -k
with open("MNIST.pkl","rb") as f:
f = pickle.load(f)
error
Traceback (most recent call last):
File "test.py", line 4, in <module>
f = pickle.load(f)
AttributeError: Can't get attribute 'DGLHeteroGraph' on <module 'dgl.heterograph' from '/home/ubuntu/.local/lib/python3.8/site-packages/dgl/heterograph.py'>
This is a known issue. Please refer to https://github.com/dmlc/dgl/issues/5574.
If you use the new version of DGL, you can dump a new graph pkl file.
how to deal with this problem?? @paoxiaode , looking for your reply, thx.
how to deal with this problem?? @paoxiaode , looking for your reply, thx.
@leaves520 This problem is due to the pkl file being dumped under an older version of DGL.
If you want to use the PATTERN, CLUSTER dataset, you can refer to https://github.com/dmlc/dgl/blob/master/python/dgl/data/pattern.py, they are now supported by DGL.
If you want to use the not DGL built-in dataset dataset(CIFAR 10 or MNIST), you can refer to https://github.com/graphdeeplearning/benchmarking-gnns/blob/master/data/superpixels/prepare_superpixels_MNIST.ipynb, use the code like below to re-dump the dataset pkl file
import pickle
import time
from data.superpixels import SuperPixDatasetDGL
from data.data import LoadData
from torch.utils.data import DataLoader
from data.superpixels import SuperPixDataset
DATASET_NAME = 'MNIST'
dataset = SuperPixDatasetDGL(DATASET_NAME)
with open('data/superpixels/MNIST.pkl','wb') as f:
pickle.dump([dataset.train,dataset.val,dataset.test],f)
This issue has been automatically marked as stale due to lack of activity. It will be closed if no further activity occurs. Thank you
How to solve this for ZINC dataset.
❓ Questions and Help
Hi,
I was trying to load a constructed dgl graph. but got the following error. Any advice for this? Thanks.
Can't get attribute 'DGLHeteroGraph' on <module 'dgl.heterograph' from '/usr/local/lib/python3.10/dist-packages/dgl/heterograph.py'>