Error using GraphDataLoader

I’m trying to construct a dataloader for the QM9EdgeDataset. I’m following the example provided here, but unfortunately the code crashes with

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Here is the minimal code:

import dgl.data

from dgl.dataloading import GraphDataLoader

dataset = dgl.data.QM9EdgeDataset(label_keys=['homo', 'lumo', 'gap', 'U0', 'U', 'H', 'G'])
TrainDataset = GraphDataLoader(dataset, batch_size=10, drop_last=False, shuffle=True)

for batched_graph, labels in TrainDataset:
    print('hi')

You are using a small batch size which results in a more number of batches. The for loop iterates for #batches and prints ‘hi’ so many times so that the memory gets filled up.

check the below line to know the number of batches in your program

len(TrainDataset)

Segmentation Fault (also known as SIGSEGV and is usually signal 11) occurs when the program tries to write/read outside the memory allocated for it

Try a larger batch size of something like 2^9 or 2^10 and see how it works.

That makes no sense. And I still have the error with 2^9 or 2^10.

If not print, There could have been something in the for loop that might be accumulating over the iterations (the way you update loss, metric, etc… can also leads to this)

By the way, I ran the above code. It works fine and contains only 13084 batches. You might need to give the code which reproduces the exact error to debug.

Thanks for your feedback. This exact code gives me error. This must be from package versions then.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.