pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.27k stars 3.65k forks source link

RecursionError on LastFM dataset #3110

Closed tetsu9923 closed 3 years ago

tetsu9923 commented 3 years ago

Hello, thank you for your awesome graph learning library! I am trying to implement LightGCN and use LastFM dataset as its input. However, I cannot check the contents of this dataset due to the following error.

from torch_geometric.datasets.last_fm import LastFM

dataset = LastFM(root="data")
print(dataset[0])
Traceback (most recent call last):
  File "/home/tetsu9923/LightGCN/lastfm_bug.py", line 4, in <module>
    print(dataset[0])
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 198, in __getitem__
    data = self.get(self.indices()[idx])
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/in_memory_dataset.py", line 84, in get
    return copy.copy(self.data)
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/copy.py", line 84, in copy
    return copier(x)
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/data.py", line 360, in __copy__
    out.__dict__['_store'] = copy.copy(self._store)
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/data.py", line 339, in __getattr__
    return getattr(self._store, key)
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/data.py", line 339, in __getattr__
    return getattr(self._store, key)
  File "/home/tetsu9923/.pyenv/versions/miniconda3-latest/lib/python3.8/site-packages/torch_geometric/data/data.py", line 339, in __getattr__
    return getattr(self._store, key)
  [Previous line repeated 992 more times]
RecursionError: maximum recursion depth exceeded

How can I deal with this error? I installed PyG from master via pip install git+https://github.com/rusty1s/pytorch_geometric.git. Thank you.

rusty1s commented 3 years ago

This usually happens if there is already a dataset given at path data. Either deleting the data/processed folder or running

from torch_geometric.datasets.last_fm import LastFM

dataset = LastFM(root="data/LastFM")
print(dataset[0])

should fix this error.

tetsu9923 commented 3 years ago

Thank you for your quick reply. deleting the data/processed folder fixed this error. Thank you so much!