diningphil/gnn-comparison

DiffPool breaks on ENZYMES?

urialon opened this issue · 5 comments

Hi @diningphil ,
Thanks again for sharing this project.

I'm getting an error while training DiffPool on ENZYMES.
It seems that it does not happen on NCI1, and that other GNN types do work on ENZYMES.
So there's nothing wrong with DiffPool nor ENZYMES, but they don't work together.

I haven't changed anything in the code, python version is 3.6.7, pytorch version 1.4.0, torch-geometric version 1.4.2, running on CPU.

I'm running

python -u Launch_Experiments.py --config-file config_DiffPool.yml --dataset-name ENZYMES --result-folder mydir --inner-processes 1 --outer-processes 10 --outer-folds 10 --debug

And getting the following error:

File "/scratch/urialon/gnn-comparison/models/graph_classifiers/DiffPool.py", line 136, in forward
    x, adj, l, e = self.diffpool_layers[i](x, adj, mask)  # x has shape (batch, MAX_no_nodes, feature_size)
  File "/scratch/urialon/gnn-comparison/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/scratch/urialon/gnn-comparison/models/graph_classifiers/DiffPool.py", line 75, in forward
    s = self.gnn_pool(x, adj, mask)
  File "/scratch/urialon/gnn-comparison/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/scratch/urialon/gnn-comparison/models/graph_classifiers/DiffPool.py", line 46, in forward
    x1 = self.bn(1, F.relu(self.conv1(x0, adj, mask, add_loop=False)))
  File "/scratch/urialon/gnn-comparison/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/scratch/urialon/gnn-comparison/venv/lib/python3.6/site-packages/torch_geometric/nn/dense/dense_sage_conv.py", line 58, in forward
    out = torch.matmul(out, self.weight)
RuntimeError: size mismatch, m1: [384 x 3], m2: [21 x 64] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:136

Any idea?
Thanks!

Hi Uri,

You are missing the 18 additional features of ENZYMES. Have you used the PrepareDataset.py script? In that file we have hardcoded the use of the additional features for the ENZYMES dataset.

My guess is that the error is caused by the new version of Pytorch Geometric (the dataset handling has changed a bit, we should have specified the versions in the requirements file) or by our refactoring prior to the release. Please give us some time to investigate the matter and we will get back to you as soon as we can.

In the meantime, if you want, you could try to revert to previous Pytorch Geometric versions, e.g. 1.4.1. We will do the same :)

Hi @diningphil , thanks for your quick reply.

It was a few weeks ago, but I definitely think that I used the PrepareDataset.py script.
If I wouldn't have used the script -- the directory DATA/CHEMICAL/ENZYMES/processed/ wouldn't exist, right?

I am able to train on ENZYMES and reproduce the accuracy from the paper using other GNN types (e.g., GIN), don't they use the 18 additional features?

I will try with Pytorch Geometric 1.4.1.
Thanks!

Dear Uri,
I ran the procedure from scratch and was not able to reproduce the behaviour you are signaling.

I have added an install script to setup a python environment with all the required packages and the right versions to make the code run. You will need the conda package manager to do that. Can you please follow the install instructions in the README file and see if you are able to run the experiments on ENZYMES?

Also, which machine are you using? I have tested it on my Ubuntu laptop, and the code worked fine. Are you using a mac?

Thanks! I'll follow the install.sh script to check where is the problem.
Everything was run on Ubuntu.

I re-created the dataset (using the PrepareDataset script) and now everything works, even without the install.sh script (i.e., using the same environment as before).

I don't know what was the problem, but now everything is fine.
Sorry for the trouble and thanks again for this wonderful project!