snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

A potential bug about DglNodePropPredDataset #470

Open caojy1998 opened 5 months ago

caojy1998 commented 5 months ago

I come up with a bug when I try to use DglNodePropPredDataset to load dataset ogbn-papers100M as DGL form. I use the script

from ogb.nodeproppred import DglNodePropPredDataset
graph_name = "ogbn-papers100M"
ogbg = DglNodePropPredDataset(graph_name)

and got the error message

File "examples/distributed/graphsage/partition_graph.py", line 21, in load_ogb
    data = DglNodePropPredDataset(name=name, root=root)
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/ogb/nodeproppred/dataset_dgl.py", line 69, in __init__
    self.pre_process()
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/ogb/nodeproppred/dataset_dgl.py", line 76, in pre_process
    self.graph, label_dict = load_graphs(pre_processed_file_path)
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/data/graph_serialize.py", line 195, in load_graphs
    return load_graph_v2(filename, idx_list)
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/data/graph_serialize.py", line 207, in load_graph_v2
    return [gdata.get_graph() for gdata in heterograph_list], label_dict
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/data/graph_serialize.py", line 207, in <listcomp>
    return [gdata.get_graph() for gdata in heterograph_list], label_dict
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/data/heterograph_serialize.py", line 66, in get_graph
    ndict = {
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/data/heterograph_serialize.py", line 67, in <dictcomp>
    ntensor[i]: F.zerocopy_from_dgl_ndarray(ntensor[i + 1])
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/backend/pytorch/tensor.py", line 466, in zerocopy_from_dgl_ndarray
    if data.shape == (0,):
  File "/opt/conda/envs/dgl-dev-gpu-117/lib/python3.8/site-packages/dgl-2.0-py3.8-linux-x86_64.egg/dgl/_ffi/ndarray.py", line 211, in shape
    for i in range(self.handle.contents.ndim)
AttributeError: 'NoneType' object has no attribute 'contents'
Segmentation fault (core dumped)

Is there a solution to this bug?