Hello, as a beginner in the field of graph neural networks, I have been working on a project that focuses on the classification of heterogeneous graphs.
I created my own dataset and performed data processing to generate a DGL (Deep Graph Library) heterogeneous graph dataset. This dataset comprises multiple heterogeneous graphs, each with its own unique set of nodes and edges.
However, I have recently encountered an issue when traversing the dataset using the GraphDataLoader
and attempting to iterate through it.
Specifically, when executing the following code snippet:
dataloader = GraphDataLoader(test_dataset, batch_size=2)
for index, result in enumerate(dataloader):
print(index)
it happened:
> dgl._ffi.base.DGLError: [09:12:11] C:\Users\Administrator\DGL_scripts\release\win-64\dgl\src\graph\./heterograph.h:67: Check failed: meta_graph_->HasVertex(vtype): Invalid vertex type: 2
Interestingly, I noticed that this error does not occur when I set the batch size to 1. I suspect that this issue may be related to the dataloader’s aggregation of multiple graphs, but I am currently at a loss when it comes to debugging and resolving this.
I kindly request your assistance in resolving this issue and shedding light on any potential solutions or insights that could help me overcome this challenge.
Thank you for your guidance and support.
The whole traceback :
Traceback (most recent call last):
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\IPython\core\interactiveshell.py", line 3526, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-4bb63157942d>", line 1, in <module>
for index, result in enumerate(dataloader):
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\torch\utils\data\dataloader.py", line 633, in __next__
data = self._next_data()
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\torch\utils\data\dataloader.py", line 677, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\torch\utils\data\_utils\fetch.py", line 54, in fetch
return self.collate_fn(data)
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\dataloading\dataloader.py", line 1376, in collate
return [self.collate(samples) for samples in transposed]
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\dataloading\dataloader.py", line 1376, in <listcomp>
return [self.collate(samples) for samples in transposed]
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\dataloading\dataloader.py", line 1330, in collate
batched_graphs = batch_graphs(items)
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\batch.py", line 173, in batch
gidx = disjoint_union(
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\heterograph_index.py", line 1432, in disjoint_union
return _CAPI_DGLHeteroDisjointUnion_v2(metagraph, graphs)
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\_ffi\_ctypes\function.py", line 212, in __call__
check_call(
File "C:\Users\Ray\anaconda3\envs\pytorch-codes\lib\site-packages\dgl\_ffi\base.py", line 70, in check_call
raise DGLError(py_str(_LIB.DGLGetLastError()))
dgl._ffi.base.DGLError: [09:12:11] C:\Users\Administrator\DGL_scripts\release\win-64\dgl\src\graph\./heterograph.h:67: Check failed: meta_graph_->HasVertex(vtype): Invalid vertex type: 2