lightaime / deep_gcns_torch

Pytorch Repo for DeepGCNs (ICCV'2019 Oral, TPAMI'2021), DeeperGCN (arXiv'2020) and GNN1000(ICML'2021): https://www.deepgcns.org
MIT License
1.13k stars 155 forks source link

Unable to train ogbg_ppa network #94

Closed aayan636 closed 2 years ago

aayan636 commented 2 years ago

Hi, I have been trying to train the ogbg_ppa example and am facing the following error:

  File "main.py", line 170, in <module>
    main()
  File "main.py", line 126, in main
    epoch_loss = train(model, device, train_loader, optimizer, criterion)
  File "main.py", line 19, in train
    print(next(iter(loader)))
  File "/home/aayan/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/home/aayan/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/home/aayan/.local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/aayan/.local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/aayan/.local/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 199, in __getitem__
    data = data if self.transform is None else self.transform(data)
  File "/home/aayan/Desktop/Research/graph-networks/deep_gcns_torch/utils/data_util.py", line 36, in extract_node_feature
    data.x = scatter(data.edge_attr,
  File "/home/aayan/.local/lib/python3.8/site-packages/torch_scatter/scatter.py", line 152, in scatter
    return scatter_sum(src, index, dim, out, dim_size)
  File "/home/aayan/.local/lib/python3.8/site-packages/torch_scatter/scatter.py", line 11, in scatter_sum
    index = broadcast(index, src, dim)
  File "/home/aayan/.local/lib/python3.8/site-packages/torch_scatter/utils.py", line 10, in broadcast
    for _ in range(src.dim(), other.dim()):
AttributeError: 'NoneType' object has no attribute 'dim'

Upon preliminary investigation, I found that the error encountered when we attempt to iterate through the dataset in main.py method train. Upon drilling down, the error was discovered in the function extract_node_feature in utils/data.util where data.edge_attr was found to be None and the scatter function was attempting to call dim method on the edge attributes, which are supposedly null. Since the edge attributes were expected, I believed that there might be a file missing in the dataset downloaded. For reference, the raw files I have are as follows:

edge.csv.gz       graph-label.csv.gz    num-node-list.csv.gz
edge-feat.csv.gz  num-edge-list.csv.gz

However I am unable to fix the error and run the training procedure. Any help would be greatly appreciated!

lightaime commented 2 years ago

Hi @aayan636. It seems it is an issue with your dataset. I can not reproduce your issue. I tried on ogb-1.2.4. The script is running fine. Can you try to download the dataset again?

aayan636 commented 2 years ago

Hi, thanks for the response! I simply ran main.py which downloaded the dataset by itself. I'm not sure why there would be an issue in the dataset downloaded. Just to be sure, could you send me the output of ls -alh in your examples/ogb/ogbg_ppa/dataset/raw folder?

lightaime commented 2 years ago

Sure. The output is total 2.8G, 818M edge.csv.gz, 2.0G edge-feat.csv.gz, 714 graph-label.csv.gz, 312K num-edge-list.csv.gz, 129K num-node-list.csv.gz

aayan636 commented 2 years ago

Thanks. It's the same for me, so probably there was some corruption. I'll try downloading the dataset again and let you know.