divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.84k stars 281 forks source link

train_gnn.py in benchmark/xgraph does not work with ba_2motifs dataset #136

Closed Usama113 closed 2 years ago

Usama113 commented 2 years ago

Hello, I tried to run the following command on the dig-stable branch python -m benchmarks.xgraph.train_gnns datasets=ba_2motifs and I got the following error:

Error executing job with overrides: ['datasets=ba_2motifs']
Traceback (most recent call last):
  File "/workspace/notebooks/external_src/DIG/benchmarks/xgraph/train_gnns.py", line 238, in main
    trainer.train(train_params=train_params, optimizer_params=optimizer_params)
  File "/workspace/notebooks/external_src/DIG/benchmarks/xgraph/train_gnns.py", line 142, in train
    loss = self._train_batch(batch, batch.y)
  File "/workspace/notebooks/external_src/DIG/benchmarks/xgraph/train_gnns.py", line 45, in _train_batch
    logits = self.model(data=data)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/workspace/notebooks/external_src/DIG/benchmarks/xgraph/gnnNets.py", line 349, in forward
    logits = self.mlps[-1](x)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 103, in forward
    return F.linear(input, self.weight, self.bias)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 1848, in linear
    return torch._C._nn.linear(input, weight, bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x40 and 20x2)

Could you please help me. Thanks in advance.

Oceanusity commented 2 years ago

Would you mind providing the model architecture and configuration information for me? Thanks.

Usama113 commented 2 years ago

From the config/models/gcn.yaml. I am using the default values

gnn_saving_dir: ''
gnn_name: 'gcn'

param:
  ba_2motifs:
      learning_rate: 0.001
      weight_decay: 0.0
      milestones: None
      gamma: None
      batch_size: 64
      num_epochs: 800
      num_early_stop: 0
      gnn_latent_dim:
        - 20
        - 20
        - 20
      gnn_dropout: 0.0
      add_self_loop: True
      gcn_adj_normalization: False
      gnn_emb_normalization: False
      graph_classification: True
      node_classification: False
      gnn_nonlinear: 'relu'
      readout: 'cat_max_sum'
      fc_latent_dim: []
      fc_dropout: 0.0
      fc_nonlinear: 'relu'
Oceanusity commented 2 years ago

Thank you for your issue. I have updated the xgraph benchmark configuration and checkpoints. Welcome to post further information if your problem still exists.