d-ailin / GDN

Implementation code for the paper "Graph Neural Network-Based Anomaly Detection in Multivariate Time Series" (AAAI 2021)
MIT License
482 stars 141 forks source link

Error occurs when starting training #6

Closed zhujun001 closed 3 years ago

zhujun001 commented 3 years ago

Hi, I encounter such error when just running command "bash run.sh 0 msl". Any idea about it? Thanks!

Traceback (most recent call last): File "main.py", line 256, in main.run() File "main.py", line 108, in run self.train_log = train(self.model, model_save_path, File "/media/home/jzhu/projects/GDN-main/train.py", line 70, in train out = model(x, edge_index).float().to(device) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, kwargs) File "/media/home/jzhu/projects/GDN-main/models/GDN.py", line 167, in forward gcn_out = self.gnn_layers[i](x, batch_gated_edge_index, node_num=node_numbatch_num, embedding=all_embeddings) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(input, kwargs) File "/media/home/jzhu/projects/GDN-main/models/GDN.py", line 73, in forward out, (new_edge_index, att_weight) = self.gnn(x, edge_index, embedding, return_attention_weights=True) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, kwargs) File "/media/home/jzhu/projects/GDN-main/models/graph_layer.py", line 72, in forward out = self.propagate(edge_index, x=x, embedding=embedding, edges=edge_index, File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 253, in propagate out = self.aggregate(out, aggr_kwargs) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 287, in aggregate return scatter(inputs, index, dim=self.node_dim, dim_size=dim_size, File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch_scatter/scatter.py", line 153, in scatter return scatter_sum(src, index, dim, out, dim_size) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch_scatter/scatter.py", line 11, in scatter_sum index = broadcast(index, src, dim) File "/media/home/jzhu/anaconda3/envs/py3/lib/python3.8/site-packages/torch_scatter/utils.py", line 13, in broadcast src = src.expand_as(other) RuntimeError: The expanded size of the tensor (1) must match the existing size (4320) at non-singleton dimension 1. Target sizes: [4320, 1, 64]. Tensor sizes: [1, 4320, 1]

QianFanCe commented 3 years ago

I meet the problem too, try this: pip install torch-geometric==1.5.0

zhujun001 commented 3 years ago

I meet the problem too, try this: pip install torch-geometric==1.5.0

Thanks!

lovechang1986 commented 2 years ago

I meet the same issue. Would you like to update the GDN based on the latest version of torch_geometric?

fede-bello commented 1 month ago

Could anyone fix this problem with a more recent version of pytorch_geometric? 1.5 is quite deprecated nowadays