Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dimension out of range (expected to be in range of [-1, 0], but got -2) [HGT] #5

Closed
pangbochen opened this issue Jul 27, 2020 · 5 comments

Comments

@pangbochen
Copy link

pangbochen commented Jul 27, 2020

pytorch 1.4.0
Dimension out of range (expected to be in range of [-1, 0], but got -2)

dataset : freebase
model: HGT

maybe the data format is wrong

Traceback (most recent call last):
File "src/main.py", line 137, in
node_rep, _ = model.forward(node_feature.to(device), node_type.to(device), edge_time.to(device), edge_type.to(device), edge_index.to(device))
File "/home/bopa/project/HNE/Model/HGT/src/model.py", line 170, in forward
meta_xs = gc(meta_xs, node_type, edge_index, edge_type, edge_time)
File "/home/bopa/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/bopa/project/HNE/Model/HGT/src/model.py", line 49, in forward
return self.propagate(edge_index, node_inp=node_inp, node_type=node_type, edge_type=edge_type, edge_time=edge_time)
File "/home/bopa/.local/lib/python3.6/site-packages/torch_geometric/nn/conv/message_passing.py", line 233, in propagate
kwargs)
File "/home/bopa/.local/lib/python3.6/site-packages/torch_geometric/nn/conv/message_passing.py", line 156, in collect
self.set_size(size, dim, data)
File "/home/bopa/.local/lib/python3.6/site-packages/torch_geometric/nn/conv/message_passing.py", line 119, in set_size
elif the_size != src.size(self.node_dim):
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got -2)

@zxp0903
Copy link

zxp0903 commented Sep 22, 2020

I found this problem too.

@xiaoyuxin1002
Copy link
Collaborator

Sorry, I am not quite sure about the error you encountered. It looks like an error with the formatting of pytorch_geometrics library.
Could you provide more details about this error? For example, did you run into that error for all 4 datasets, or just for Freebase? And under what settings did you get that error (supervised VS unsupervised, attributed VS unattributed)?

@Qidong-Liu
Copy link

I also encountered this problem, for both supervised and unsupervised.

PubMed dataset
Pytorch 1.7.0 CUDA 10.2 Python 3.7

@Luokejin
Copy link

Luokejin commented Nov 13, 2020

I got this error,too. And I use the latest version of torch_geometric. I saw the code of HGT 's author who use the version of 1.3.2. But I can't install the dependencies with this version. Could you please help us slove this problem and show your torch_geometric version?

@xiaoyuxin1002
Copy link
Collaborator

I think the bug is due to different versions of torch_geometric.
I have updated the codes accordingly and HGT now works fine on PubMed using torch_geometric=1.6.1, torch=1.7.0.
Please feel free to check again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants