Closed MishanyaGeniyInformatiki closed 2 years ago
Apparently in PyG2.0 the GCN parameters self.weight were changed to a linear layer self.lin. whose weights shape also happen to be transposed so you have to both change the loaded dict keys as well as transpose the corresponding weights. The following works for me:
params_dict=torch.load(ckpt_path)['state_dict']
params_dict["convs.0.lin.weight"] = params_dict["convs.0.weight"].t()
params_dict["conv1.lin.weight"] = params_dict["conv1.weight"].t()
model.load_state_dict(params_dict,strict=False)
The "strict = False " is to account for the now unexpected keys.
Thank you for reminding me. The Tutorial example is a little out of date. We will fix it soon. Please refer to the PyG2.0 version: https://github.com/divelab/DIG/blob/dig-stable/examples/xgraph/gnnexplainer.ipynb
Since there is no more discussion, I will close this issue.
Hi there! I use DIG. I'm trying to run a code from the 'Tutorial for GNN Explainability'.
Versions of installed packages: python 3.10.4 pwtorch 1.12.0 torch-geometric 2.0.4 dive-into-graphs 0.1.2
But I get an error:
What can it mean? The model does not find the necessary weights in GCN_2l_best.ckpt?