snap-stanford / ogb

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

label_prop.py fails on MAG240M dataset #137

Closed island02 closed 3 years ago

island02 commented 3 years ago

https://github.com/snap-stanford/ogb/blob/master/examples/lsc/mag240m/label_prop.py When I run the above program, I get the following error.

Traceback (most recent call last):
  File "label_prop.py", line 52, in <module>
    y_pred = model(y_train, adj_t, train_idx).argmax(dim=-1)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch_geometric/nn/models/label_prop.py", line 46, in forward
    out[mask] = y[mask]
IndexError: index 3739065 is out of bounds for dimension 0 with size 1112392

I think it is because the range of values in train_idx, passed to LabelPropagation() as a mask, is up to about 100 million, even though the size of y_train is only about 1.11 million. I would like to know if this is a problem with my environment or if there is a way to fix it.

My environment is as follows. ogb==1.3.0 torch==1.8.0 torch-geometric @ git+https://github.com/rusty1s/pytorch_geometric.git@ed97ab797182fb39ab59c6736dbb74a5bdcd41cd

rusty1s commented 3 years ago

Thanks for reporting. You are absolutely right. I fixed the label_prop.py example in master, see here. Sorry for the inconvenience! Please let me know if everything works as expected.

island02 commented 3 years ago

Thank you, it works! The following two corrections were necessary. They are really minor fixes.