GraphGym incompatible with custom PyG torch_geometric.data.Dataset
datasets
#6474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GraphGym assumes that if you use a PyG dataset it is a
torch_geometric.data.InMemoryDataset
dataset. This is problematic because if you are a user like me that would like to do model selection for your custom-madetorch_geometric.data.Dataset
dataset, well you can't, at least out of the box.Specifically, the issue comes from
torch_geometric/graphgym/loader.py
where on several occasions thedataset._data
attribute is accessed, andtorch_geometric.data.Dataset
datasets have no such attribute. I replaced these withdataset.<a method>()
to access information about the dataset.Additionally, since the data-loader calling strategy depended on
dataset._data
attribute, I designed a new one. With these changes, one can use both types of PyG datasets. I'm then able to run GraphGym both on my own dataset and on the ones used in the examples. I tried to retain as much as possible from the original code, to avoid unforeseen issues. Please let me know if anything needs explanation.Cheers!
How to reproduce the error:
torch_geometric.data.Dataset
dataset register to/pytorch_geometric/graphgym/custom_graphgym/loader
pytorch_geometric/graphgym/main.py
.Here are my examples of some data, a register, and the config I used.
example_files 2.zip