Open guanfaqian opened 3 months ago
是我自己数据的问题。。。已经解决
是不是不能跑ogbnarxiv这种大型数据集?train的时候好像for step, (, seeds, blocks) in enumerate(dataloader):得不到数据?
Classes:40
Feature dim: 128
Graph has 169343 nodes, 2484941 edges.
GCN(
(layers): ModuleList(
(0): GraphConv(in=128, out=128, normalization=both, activation=None)
(1): GraphConv(in=128, out=40, normalization=both, activation=None)
)
(dropout): Dropout(p=0.5, inplace=False)
)
/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/dgl/dataloading/dataloader.py:1149: DGLWarning: Dataloader CPU affinity opt is not enabled, consider switching it on (see enable_cpu_affinity() or CPU best practices for DGL [https://docs.dgl.ai/tutorials/cpu/cpu_best_practises.html])
dgl_warning(
Traceback (most recent call last):
File "/mnt/drive0/gfq/link_steal_pets2024-master/train_gnn.py", line 87, in <module>
train_acc, test_acc = run_gnn(args, run_data)
File "/mnt/drive0/gfq/link_steal_pets2024-master/train/target.py", line 52, in run_gnn
loss = loss_fcn(batch_pred, batch_labels)
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/torch/nn/modules/loss.py", line 1179, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/torch/nn/functional.py", line 3059, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: 0D or 1D target tensor expected, multi-target not supported
您好,很高兴您能分享你的工作!
我在运行你的代码时候我把train_gnn.py的--model参数改为gcn,代码就运行错误了,似乎网络的写法有问题?我要怎么改呢?
`Traceback (most recent call last): File "/mnt/drive0/gfq/link_steal_pets2024-master/train_gnn.py", line 87, in
train_acc, test_acc = run_gnn(args, run_data)
File "/mnt/drive0/gfq/link_steal_pets2024-master/train/target.py", line 30, in run_gnn
model = get_gnn_model(args)
File "/mnt/drive0/gfq/link_steal_pets2024-master/utils/load_model.py", line 14, in get_gnn_model
model = GCN(config.in_feats, config.n_hidden, config.n_classes, config.gnn_layers, F.relu, config.batch_size, config.num_workers, config.dropout)
File "/mnt/drive0/gfq/link_steal_pets2024-master/model/gnn.py", line 125, in init
self.layers.append(dglnn.GraphConv(n_hidden, n_classes, allow_zero_in_degree=True))
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/dgl/nn/pytorch/conv/graphconv.py", line 314, in init
self.bias = nn.Parameter(th.Tensor(out_feats))
File "/home/gfq/anaconda3/envs/link_steal/lib/python3.9/site-packages/torch/nn/parameter.py", line 40, in new
return torch.Tensor._make_subclass(cls, data, requires_grad)
RuntimeError: Only Tensors of floating point and complex dtype can require gradients
进程已结束,退出代码为 1 `