Correct way to create a NeighborLoader for heterogeneous graphs #7681
-
Hello! I am trying to create a GNN-based model for node classification on a heterogeneous graph (the graph has 3 types of nodes and 4 types of edges while the goal is to classify nodes from one of the 3 types). Full-batch training of the models works fine. However, when I try mini-batch training with NeighborLoader for sampling, I get the following error: The code for creating the NeighborLoader instance (sampling 8 neighbors for each edge type for each of the 2 GNN layers; dataset is an instance of HeteroData): I would like to ask what am I doing wrong and what is the correct way for creating NeighborLoader instances for heterogeneous graphs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'm happy to help if you could provide the full error message and a script to reproduce it :) |
Beta Was this translation helpful? Give feedback.
It appears that the problem was in the versions and probably the OS as well (I was testing the code on Windows 11 with Python 3.7 and the following versions:
torch - 1.12.0
torch-cluster - 1.6.0
torch-geometric - 2.2.0
torch-scatter - 2.0.9
torch-sparse - 0.6.13
When I run the code on a Unix-based OS with newer versions of the libraries it does not throw any error.