runtime error of _prepare_subgraphs for negative data
Do you meet the following problem when you run the code?
subgraphs_neg.append(self._prepare_subgraphs(nodes_neg, r_label_neg, n_labels_neg))
Exception has occurred: AssertionError For return_array=False, there should be one and only one edge between u and v, but get 0 edges. Please use return_array=True instead
Do you meet the following problem when you run the code?
subgraphs_neg.append(self._prepare_subgraphs(nodes_neg, r_label_neg, n_labels_neg))
Exception has occurred: AssertionError For return_array=False, there should be one and only one edge between u and v, but get 0 edges. Please use return_array=True instead Classmate, I am also reproducing this model, can you communicate?
Encounter the same error. Did you guys solve it? thank you!
My python version is 3.8.10. I installed the author's requirements in a virtual environment and got similar errors.
The assertion error is due to not finding any edge between node 0 and node 1 to begin with. I found that returning an empty array would help instead of throwing this error. I changed the code in subgraph_extraction/datasets.py line 147 from
edges_btw_roots = subgraph.edge_id(0, 1)
to
edges_btw_roots = subgraph.edge_id(0, 1, return_array=True)
Doing this step eliminated the assertion error but the code threw another dimension mismatch error for me in managers/trainer.py file line 58 where they compute the loss:
I fixed it by making this modification:
loss = self.criterion(score_pos.squeeze(), score_neg.view(len(score_pos), -1).mean(dim=1), torch.ones(score_pos.numel()).to(device=self.params.device))
Hope it helps you all.