superlouis/GATGNN

Training fails with: Expected a value of type 'Tensor'

Closed this issue · 3 comments

Hi,
I'm trying to to train the model (on the CGCNN bulk-mod dataset), to do some comparisons between this and other models on transfer learning expensive properties.

Traceback (most recent call last):
  File "train.py", line 111, in <module>
    predictions  = net(data)  
  File "/home/ash/anaconda3/envs/torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl  
    result = self.forward(*input, **kwargs)  
  File "/media/ash/Windows/Users/awsom/Documents/ResearchProjects/Anisotropy ML/GATGNN2/gatgnn/model.py", line 214, in forward  
    x     = self.node_att[a_idx](x,edge_index,edge_attr)  
  File "/home/ash/anaconda3/envs/torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/media/ash/Windows/Users/awsom/Documents/ResearchProjects/Anisotropy ML/GATGNN2/gatgnn/model.py", line 145, in forward
    return self.propagate(edge_index, x=x,edge_attr=edge_attr)
  File "/home/ash/anaconda3/envs/torch/lib/python3.7/site-packages/torch_geometric/nn/conv/message_passing.py", line 236, in propagate
    out = self.message(**msg_kwargs)
  File "/media/ash/Windows/Users/awsom/Documents/ResearchProjects/Anisotropy ML/GATGNN2/gatgnn/model.py", line 158, in message
    alpha = softmax(alpha, edge_index_i, size_i)
  File "/home/ash/anaconda3/envs/torch/lib/python3.7/site-packages/torch_geometric/utils/softmax.py", line 34, in softmax
    out = src - gather_csr(segment_csr(src, ptr, reduce='max'), ptr)
  File "/home/ash/anaconda3/envs/torch/lib/python3.7/site-packages/torch_scatter/segment_csr.py", line 110, in segment_csr
    return segment_max_csr(src, indptr, out)[0]
RuntimeError: segment_max_csr() Expected a value of type 'Tensor' for argument 'indptr' but instead found type 'int'.
Position: 1
Value: 2135
Declaration: segment_max_csr(Tensor src, Tensor indptr, Tensor? out=None) -> ((Tensor, Tensor))
Cast error details: Unable to cast Python instance to C++ type (compile in debug mode for details)

I'm using pytorch 1.6.0, since I couldn't get a working version of geometric with 1.3.0.
Should I try using pytorch 1.5.0 or 1.4.0 maybe, or is there a simple fix?

Very excited to see attention in the cg-nn space; Hopfields is All You Need would seem to indicate that this type of model could have the same kind of aggressive generalizability as transformers - good luck!

Hi,
Thank you for your reply. Sorry for the confusion, I'm running on Linux, I just keep my research files in a dual-booted windows directory. I'll check if moving it to the Linux partition will fix the problem. I'll also try it with the versions you suggested. Thanks!

It was a versioning issue - installing pytorch 1.5.0, pytorch-geometric 1.4.3, and appropriate 1.5.x pytorch-geometric dependencies fixed it. Thank you for your help!