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

sage.py是不是有点问题? #2

Open
guanfaqian opened this issue Jul 7, 2022 · 1 comment
Open

sage.py是不是有点问题? #2

guanfaqian opened this issue Jul 7, 2022 · 1 comment

Comments

@guanfaqian
Copy link

我train目标模型的时候按默认的gat以及gin没问题。
argparser.add_argument('--target-model', type=str, default='sage')改成sage

10629 3543 3544
Traceback (most recent call last):
File "/home/gfq/code/privacy/GNNStealing/my_code/train_target_model.py", line 82, in
target_model = run_sage_target(args, device, data)
File "/home/gfq/code/privacy/GNNStealing/my_code/src/sage.py", line 195, in run_sage_target
batch_pred, embs = model(blocks, batch_inputs)
File "/home/gfq/anaconda3/envs/GNNStealing/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/gfq/code/privacy/GNNStealing/my_code/src/sage.py", line 83, in forward
h = self.layers[i](blocks[i], h)
File "/home/gfq/anaconda3/envs/GNNStealing/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/gfq/anaconda3/envs/GNNStealing/lib/python3.8/site-packages/dgl/nn/pytorch/conv/sageconv.py", line 241, in forward
graph.dstdata['h'] = graph.srcdata['h']
File "/home/gfq/anaconda3/envs/GNNStealing/lib/python3.8/site-packages/dgl/view.py", line 81, in setitem
self._graph._set_n_repr(self._ntid, self._nodes, {key : val})
File "/home/gfq/anaconda3/envs/GNNStealing/lib/python3.8/site-packages/dgl/heterograph.py", line 3992, in _set_n_repr
raise DGLError('Expect number of features to match number of nodes (len(u)).'
dgl._ffi.base.DGLError: Expect number of features to match number of nodes (len(u)). Got 4427 and 1930 instead.

进程已结束,退出代码为 1

就报错了。

@guanfaqian
Copy link
Author

好像是dgl版本问题,我按您的0.7.2好像可以。不过需要把按https://github.com/dmlc/dgl/issues/3791更改dgl里面的
num_data = len(dataset) => num_data = len(dataset.nodes())

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

1 participant