HeterSumGraph icon indicating copy to clipboard operation
HeterSumGraph copied to clipboard

bug:总是提示KeyError: 'sh'

Open hustcxx opened this issue 4 years ago • 2 comments

@brxx122 您好: 下载了您提供的cnn的数据集,采用运行命令 python train.py --cuda --gpu 0 --data_dir ./data/middledata_2/ --cache_dir ./cache/cnn --embedding_path ./embedding_dir/glove.42B.300d.txt --model HSG --save_root ./data/model_path --log_root ./log --lr_descent --grad_clip -m 3,其他的都没有改过,但是提示sh的keyerror错误,找了很久没有发现错误是什么原因导致的,是否可以帮忙解答下。报错详细信息如下: result = self.forward(*input, **kwargs) File "/data/cxx/program/extractivemethod/heterogeneousgraph/module/GATLayer.py", line 119, in forward h = g.ndata.pop('sh') File "/home/cxx/anaconda3/envs/cxxnlp/lib/python3.6/_collections_abc.py", line 795, in pop value = self[key] File "/home/cxx/anaconda3/envs/cxxnlp/lib/python3.6/site-packages/dgl/view.py", line 66, in getitem return self._graph._get_n_repr(self._ntid, self._nodes)[key] File "/home/cxx/anaconda3/envs/cxxnlp/lib/python3.6/site-packages/dgl/frame.py", line 393, in getitem return self._columns[name].data KeyError: 'sh'

hustcxx avatar Dec 30 '20 01:12 hustcxx

I too have this problem, but only if I run on CPU with --model HSG (rather than HDSG).

KeyError-sh

mhillebrand avatar Mar 09 '21 18:03 mhillebrand

@mhillebrand @hustcxx Hi, I had this "sh" problem too when debugging. It's supposed to be a data problem. At line 113, reduce_func can't be called because there are no eligible edges, and that's why the key "sh" is not assigned. I solved it by checking the edges.

cece00 avatar Jan 20 '22 09:01 cece00