jianhao2016 / AllSet

This is the GitHub repository for our ICLR22 paper: "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could you please update the code to use the latest version of PyTorch Geometric?

liyongkang123 opened this issue · comments

First of all thank you very much for your excellent work, I tried to run your program on my own computer. I am using the latest version 2.0.3 of pyg, and version 1.9.0 of pytorch.

As you know, there are some differences between the 2.0.3 version of pyg and the 1.6.3 version used in your project.
After my own modification, I have been able to run HyperGCN, CEGAT, CEGCN and AllSetTransformer, but when I try to run HGNN, HNHN and HCHA, the code always reports an error, and the error occurs here:

layers.py line405
self.flow = 'target_to_source'
out = self.propagate(hyperedge_index, x=out, norm=D, alpha=alpha, size=(num_edges, num_nodes))

or
layers.py line303
self.flow = 'target_to_source'
out = self.propagate(hyperedge_index, x=out, norm=data.D_v_alpha_inv, size=(num_edges, num_nodes))
and it shows :
ValueError: Encountered tensor with size 4287 in dimension 0, but expected size 2708.

with 'cora' dataset.

I really find it very difficult to solve this problem, could you please update your code to help me out. Thank you very much

Hi @liyongkang123 ,

Thanks for being interested in our work!

Regarding your issue, have you tried to modify the code in the way that AllSetTransformer define propagations? It can be found at

reversed_edge_index = torch.stack(

Basically, instead of using
image

Try to create a reverse hyperedge_index (reverse_hyperedge_index[0] = hyperedge_index[1] and reverse_hyperedge_index[1] = hyperedge_index[0]). Also remember to make the smallest hyperedge id to 0 (like in L453-L454).

Currently, I do not have time to rewrite things and test them. Nevertheless, please let me know if my suggestion works or not. I think it should work...

Thanks,
Eli

Thank you very much for your explanation and inspiration. I carefully compared the documentation of the latest version of pyg with the documentation of version 1.6.3 and found that your code was changed from

 self.flow = 'source_to_target'
out = self.propagate(hyperedge_index, x=x, norm=B, alpha=alpha,   size=(num_nodes, num_edges))
self.flow = 'target_to_source'
 out = self.propagate(hyperedge_index, x=out, norm=D, alpha=alpha, size=(num_edges, num_nodes))

to

out = self.propagate(hyperedge_index, x=x, norm=B, alpha=alpha,size=(num_nodes, num_edges))
out = self.propagate(hyperedge_index.flip([0]), x=out, norm=D,alpha=alpha, size=(num_edges, num_nodes))

Now the original problem has been solved, I am currently using pyg2.0.4 version,
and then I found that if I update to version 2.0.5, your AllSetTransformer will not work properly, I am trying to solve this problem and it should not be a problem. I am concerned about the constant updates of pyg and its backward compatibility. This is really kind of funny.

Anyhow, thank you very much for your help, at least I can run all the models smoothly now.

Thanks,
Li

Hi @liyongkang123 ,

Great! Glad to hear that you work it out. Indeed, PyG compatibility is a bit annoying... My personal take is to stay with some "stable" PyG version and not keep updating it.

Anyway, I'll close the issue for now. Please feel free to reopen it if you have further questions.

Thanks,
Eli