getting errors in training and while inferencing the model
uttu-parashar opened this issue · 10 comments
-
I have created a new environment using your .sh file and running the training script with the same datasets. But I am getting this error.
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 21 but got size 19 for tensor number 1 in the list.
-
While running your generate_confs script I am getting this error. in this line
data = Batch.from_data_list(data_list=[tg_data])
TypeError: argument of type 'int' is not iterable
-
if I am passing data directly to the model bypassing above line then in line
model(tg_data, inference=True, n_model_confs=n_confs*2)
I am getting this error
AttributeError: 'GlobalStorage' object has no attribute 'bincount'
NOTE : While passing the data directly to the model i changedn_atoms_per_mol = data.batch.bincount()
TO
n_atoms_per_mol = data.bincount()
in get_neighbor_ids function of model.utils script. If i am not changing this line then the error is likeNoneType attribute has no attribute bincount()
This seems related to #2. Which version of torch-geometric and pytorch are you using? Could you try downgrading to torch-geometric 1.6.3. and pytorch to 1.7.0 to see if this helps?
thanks for the reply... yes, it is working with older versions of torh_geometric and torch. but I want to make it work on the latest versions of torch_geometric and torch. any suggestion you want to suggest.? like where I should make changes to make it work on torch and torch_geometric latest versions.?
thanks for the reply... yes, it is working with older versions of torh_geometric and torch. but I want to make it work on the latest versions of torch_geometric and torch. any suggestion you want to suggest.? like where I should make changes to make it work on torch and torch_geometric latest versions.?
Well, I get the same problem that data.x
has different shape and can not be concated together. It uses one-hot
encoding and different molecular has different atom counts.
yes, when DataLoader creates batches of data it concatenates the tensor of values internally. That's wherein the new version of torch_geometric and torch shape mismatch error is occurring.
data.x
is the first attribute where this error is occurring. I think the same error might occur when DataLoader will try to concatenate other attributes like edge_attr to create batches.
Hi, just wanted to come back to this. I haven't had a chance to play around with the new version of torch_geometric, which I suspect is causing most of the issues. Were you able to get the code to work with pyg 2.0? If not, would this be helpful? I'm considering putting in some effort to upgrade the repo to pyg 2.0 if it's useful for folks
The latest version of torch_geometric this repo is working with is 1.7.2. After 1.7.2 they directly released torch_geometric 2.0 versions and some major changes might be there. The problem is occurring in torch_geometric 2.0 versions when DataLoader is trying to create baches of data objects. For creating batches it needs to concatenate data object attributes in the required right dimensions and that's where some attributes are being concatenated in wrong dimensions and shape mismatch error is occurring. I tried writing my collate function but torch_geometric is deleting our collate function internally as soon as we are passing it. I also tried replacing their DataLoader with torch DataLoader with Our collate function --
with this experiment, I was able to create batches of data objects but in the model class
for i, (s, e) in enumerate(self.dihedral_pairs.t()):
# this indicates which neighbor is the correct x <--> y map (see overleaf doc)
self.x_map_to_neighbor_y[i, 0:len(self.neighbors[s.item()])] = self.neighbors[s.item()] == e
self.y_map_to_neighbor_x[i, 0:len(self.neighbors[e.item()])] = self.neighbors[e.item()] == s
here I was getting key errors in
def assign_neighborhoods(self, x, edge_index, edge_attr, batch, data):
Function
Any updates on this issue?
I haven't had a chance to look at this yet, unfortunately. I'll take a closer look over the next week and report back. Sounds like updating the model to work with torch_geometric 2 would be helpful for many users
any update on this issue.?