ma-compbio / hyper-sagnn Goto Github PK
View Code? Open in Web Editor NEWhypergraph representation learning, graph neural network
License: MIT License
hypergraph representation learning, graph neural network
License: MIT License
Where is the walks file
Hello, I am very admiring your work.But I notice last line of main.py can train both model of classifier_model and Randomwalk_Word2vec but setting loss=(loss, 1.0), (loss2, 0.0) can only train model of classifier_model, right?
Then here is my question, setting loss=(loss, 1.0), (loss2, 1.0), code got error:
And I want to know whether only one model of classifier_model perform better or both model?
Hi, thanks for sharing your great code.
I encountered some errors while running the code.
I used python 3.7.10 with tensorflow 1.14.0 and pytorch 1.9.0 in anaconda3 environment (cuda 11.1 with RTX 3090)
(Summary of my question is written at the last part of the issue.)
At Code directory, I executed the following
python main.py --data MovieLens -f walk
This returned the following error:
torch.Size([15594, 64])
Traceback (most recent call last):
File "main.py", line 732, in <module>
summary(classifier_model, (3,))
File "/home/user/Desktop/ab/Hyper-SAGNN/Code/torchsummary.py", line 73, in summary
model(*x)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 272, in forward
dynamic, static, attn = self.get_embedding(x, slf_attn_mask, non_pad_mask, return_recon)
File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 241, in get_embedding
dynamic, static, attn = self.encode1(x, x, slf_attn_mask, non_pad_mask)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
result = forward_call(*input, **kwargs)
File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 614, in forward
dynamic = self.pff_n1(dynamic * non_pad_mask) * non_pad_mask
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
result = forward_call(*input, **kwargs)
File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 355, in forward
output = self.w_stack[i](output)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
result = forward_call(*input, **kwargs)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 298, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 295, in _conv_forward
self.padding, self.dilation, self.groups)
TypeError: conv1d() received an invalid combination of arguments - got (Tensor, Parameter, Parameter, tuple, tuple, tuple, int), but expected one of:
* (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple, tuple, tuple, int)
* (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)
didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple, tuple, tuple, int)
This error seems to be happening at line 337 at Modules.py "self.w_stack.append(nn.Conv1d(dims[i], dims[i + 1], 1, use_bias))" so I changed this to "self.w_stack.append(nn.Conv1d(dims[i], dims[i + 1], 1, bias= use_bias))".
(This removed error but I'm not sure this is right solution.)
After doing this, another error happened:
Data file: ../walks/MovieLens/p2_q0.25_r10_l40_walks.txt
Vocab size: 15593 + UNK
Words per epoch: 6237200
params to be trained 2070189
[ Epoch 0 of 300 ]
Traceback (most recent call last):
File "main.py", line 761, in <module>
optimizer=[optimizer], epochs=300, batch_size=batch_size, only_rw=False)
File "main.py", line 301, in train
args, model, loss, training_data, optimizer, batch_size, only_rw, train_type)
File "main.py", line 205, in train_epoch
pred, batch_y, loss_bce, loss_recon = train_batch_hyperedge(model_1, loss_1, batch_edge, batch_edge_weight, type, y=batch_y)
File "main.py", line 115, in train_batch_hyperedge
x, y, w = generate_negative(x, "train_dict", type, w)
File "main.py", line 448, in generate_negative
x = pad_sequence(x, batch_first=True, padding_value=0).to(device)
File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/utils/rnn.py", line 363, in pad_sequence
return torch._C._nn.pad_sequence(sequences, batch_first, padding_value)
TypeError: pad_sequence(): argument 'sequences' (position 1) must be tuple of Tensors, not Tensor
This error seems to be happening at line 24 at utils.py "return torch.as_tensor(vec, dtype = dtype)" so I changed this to " return [torch.as_tensor(v, dtype=dtype) for v in vec]".
After doing this, no further error occured during execution. But the training results(attached as Result_MovieLens_walk.txt) shows that "skipgram: 0.0000, recon: 0.0000". I'm not sure this is right result. Also AUC and AUPR values seems to be much lower than the result in the paper.
I'm worried because there can be more parts that does not work as intended but not detected as errors.
So my question is...
(As some errors occured with my environment) Would you check whether code works properly as intended with the environment? Or can you let me know the exact environment(with detailed version) that works well as intended without errors?
Also, I think it would be helpful if you let me know the examplary result of "python main.py --data MovieLens -f walk" like attached Result_MovieLens_walk.txt file. It will be helpful to check whether the code is running well.
The code gives tons of warning of Deprecations "Warning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torch.bool instead." The warnings mess up the layout of output messages.
It is just too painful for a user to scrutinize the code piece by piece for this warning. Please fix it. Appreciated!
Edit:
Solved by backing to Pytorch 1.1.
Hi, thanks for sharing the code of the exciting work. I have several questions about the paper and the implementation.
I appreciate any help you can provide.
打扰您了,我在运行程序时在random_walk.py文件中的函数preprocess_transition_probs(sg)产生了报错,报错内容如下:
Traceback (most recent call last):
File "E:/pythonProject/Hyper-SAGNN/Hyper-SAGNN/Code/main.py", line 608, in
walk_path = random_walk(args, num, train_data)
File "E:\pythonProject\Hyper-SAGNN\Hyper-SAGNN\Code\random_walk.py", line 263, in random_walk
preprocess_transition_probs(G)
File "E:\pythonProject\Hyper-SAGNN\Hyper-SAGNN\Code\random_walk.py", line 110, in preprocess_transition_probs
alias_t = p.result()
File "D:\ZKJ\anaconda3\envs\tensorflow2\lib\concurrent\futures_base.py", line 428, in result
return self.__get_result()
File "D:\ZKJ\anaconda3\envs\tensorflow2\lib\concurrent\futures_base.py", line 384, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
不知如何修改程序可以消除错误,再次对打扰您表示歉意。
Hi,
Just run the demo code, but have the issue FileNotFoundError: [Errno 2] No such file or directory: '../walks/wordnet/'
Hi,
Thanks for sharing the code. I am currently seeing a runtime error when I try to run the code. I have included the details below. Can you please take a look into this:
python version: 3.6.10
pytorch version: 1.6.0
tensorflow version: 1.15.2
run command: python main.py --data wordnet -f adj
WARNING:tensorflow:From /home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow_core/init.py:1473: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.
1.0 -0.5
model_no_randomwalk
no specific train weight
Node type num [40750 18 40752]
[5. 5. 5. ... 5. 5. 5.]
[5. 5. 5. ... 5. 5. 5.] 5.0 5.0
walk type
Traceback (most recent call last):
File "main.py", line 604, in
node_list = np.arange(num_list[-1]).astype('int')
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
FileNotFoundError: [Errno 2] No such file or directory: '../walks/wordnet/'
Hello, Hyper-SAGNN is a really a good work. We want to conduct some experiments using this model. Could you please tell me how to reproduce node classification task in the paper using your code.
Hi,
Thank you for the great code. I can successfully run the code but it doesn't show any output as like in the paper. Therefore I want to know how can I reproduce the results and visualizations as shown in the paper. Your guidance would be highly appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.