snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

examples/linkproppred/citation2/cluster_gcn.py crashes during evaluation #293

Closed JeanKaddour closed 2 years ago

JeanKaddour commented 2 years ago

Tested with torch 1.10.1 and torch-geometric 2.0.3

  File "/home/jean/Research/Projects/ogb/examples/linkproppred/citation2/cluster_gcn.py", line 223, in main
    result = test(model, predictor, data, split_edge, evaluator,
  File "/home/jean/anaconda3/envs/ogb/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "/home/jean/Research/Projects/ogb/examples/linkproppred/citation2/cluster_gcn.py", line 119, in test
    weights = [(conv.weight.cpu().detach().numpy(),
  File "/home/jean/Research/Projects/ogb/examples/linkproppred/citation2/cluster_gcn.py", line 119, in <listcomp>
    weights = [(conv.weight.cpu().detach().numpy(),
  File "/home/jean/anaconda3/envs/ogb/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1177, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'GCNConv' object has no attribute 'weight'

Should it be conv.lin.weight.t() instead?

weihua916 commented 2 years ago

Hi! Thanks for reporting! @rusty1s Could you please update the example code to be compatible with PyG 2.0?

rusty1s commented 2 years ago

Should be fixed in the example, see https://github.com/snap-stanford/ogb/pull/295.