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

Got a pytorch RuntimeError when reproducing the unsup result #4

Closed
patch2015 opened this issue Jun 28, 2020 · 1 comment
Closed

Got a pytorch RuntimeError when reproducing the unsup result #4

patch2015 opened this issue Jun 28, 2020 · 1 comment

Comments

@patch2015
Copy link

tried train_pytorch_U2GNN_UnSup.py and got:

Namespace(batch_size=4, dataset='PTC', dropout=0.5, ff_hidden_size=1024, fold_idx=1, learning_rate=0.005, model_name='PTC', num_epochs=50, num_hidden_layers=2, num_neighbors=4, num_self_att_layers=1, run_folder='../', sampled_num=512)
Loading data...
loading data
classes: 2
maximum node tag: 19
data: 344
19
Loading data... finished!
Writing to C:\Users\Administrator\Desktop\runs_pytorch_U2GNN_UnSup\PTC

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\U2GNN\U2GNN_pytorch\train_pytorch_U2GNN_UnSup.py", line 206, in
train_loss = train()
File "C:\Users\Administrator\Desktop\U2GNN\U2GNN_pytorch\train_pytorch_U2GNN_UnSup.py", line 157, in train
logits = model(X_concat, input_x, input_y)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "C:\Users\Administrator\Desktop\U2GNN\U2GNN_pytorch\pytorch_U2GNN_UnSup.py", line 31, in forward
input_Tr = F.embedding(input_x, X_concat)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\functional.py", line 1724, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.cuda.IntTensor instead (while checking arguments for embedding)

Seems like a int32 to int64 error
so fixed by adding "input_x = input_x.astype(np.int64)" behind "input_x = np.array(input_neighbors)" in line 124

@daiquocnguyen
Copy link
Owner

daiquocnguyen commented Jun 29, 2020

Our unsupervised results shown in our paper are obtained using the Tensorflow implementation. I do think the Pytorch implementation can get better performance.

Note that in case you follow our unsupervised learning, you may get risks. Reviewers from ICLR and ICML did not accept our unsupervised results (because of too good to be true). I clearly mentioned that I just followed some unsupervised graph embedding models to use all nodes from the entire dataset to train the unsupervised U2GNN, but they did not accept this fact.

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

2 participants