question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraphGym: graph classification with PyG datasets raises KeyError: 'train_graph_index'

See original GitHub issue

🐛 Describe the bug

When setting up a configuration for graph classification with a dataset in PyG format an error message is received during loading of the dataset.

Error message:

Traceback (most recent call last):
  File "main.py", line 38, in <module>
    loaders = create_loader()
  File ".../lib/python3.8/site-packages/torch_geometric/graphgym/loader.py", line 301, in create_loader
    id = dataset.data['train_graph_index']
  File ".../lib/python3.8/site-packages/torch_geometric/data/data.py", line 371, in __getitem__
    return self._store[key]
  File ".../lib/python3.8/site-packages/torch_geometric/data/storage.py", line 67, in __getitem__
    return self._mapping[key]
KeyError: 'train_graph_index'

This is the configuration file I use:

out_dir: results
dataset:
  format: PyG
  name: MNIST
  task: graph
  task_type: classification
  transductive: false

The error appears to be that the attribute “train_graph_index” is only set for OGB-formatted datasets in load_ogb() in graphgym/loader.py, but is expected to be present for every dataset in create_loader.

Environment

  • PyG version: 2.0.4
  • PyTorch version: 1.10.2
  • OS: Linux, kernel 5.10
  • Python version: 3.8.12
  • CUDA/cuDNN version: ./.
  • How you installed PyTorch and PyG (conda, pip, source): conda
  • Any other relevant information (e.g., version of torch-scatter):

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
HelgeScommented, Apr 28, 2022

Yes, using a random split would work, but I understand we should use a given split if available.

I only picked MNIST as an example here, but ultimately want to use my own dataset in PyG format; there a random split would be fine.

0reactions
rusty1scommented, Apr 22, 2022

@JiaxuanYou @HelgeS Any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managing Experiments with GraphGym - PyTorch Geometric
The experiment examines 96 models in the recommended GNN design space, on 2 graph classification datasets. Each experiment is repeated 3 times, and...
Read more >
GraphGym and PyG [Advanced PyTorch Geometric Tutorial 2]
In this tutorial, we explore the structure of GraphGym, a new tool that simplifies experimentation with GNN, and its integration in PyG.
Read more >
Creating a Custom Dataset in Pytorch Geometric - YouTube
Graph Neural Networks. GNN Project #2 - Creating a Custom Dataset in Pytorch Geometric. 17K views 1 year ago. DeepFindr. DeepFindr.
Read more >
Advanced Representation Learning on Graphs - SNAP: Stanford
PyG (PyTorch Geometric) is a PyTorch library to enable deep learning on graphs ... simplifies implementing and working with Graph Neural Networks (GNNs) ......
Read more >
Hands-On Guide to PyTorch Geometric (With Python Code) -
PyTorch Geometric(PyG) is a python framework for deep learning on irregular ... Citeseer, Pubmed), all graph classification datasets from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found