Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting errors in training and while inferencing the model #4

Open
uttu-parashar opened this issue Dec 31, 2021 · 10 comments
Open

getting errors in training and while inferencing the model #4

uttu-parashar opened this issue Dec 31, 2021 · 10 comments

Comments

@uttu-parashar
Copy link

uttu-parashar commented Dec 31, 2021

  1. 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.

  2. 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

  3. 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 changed n_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 like NoneType attribute has no attribute bincount()

Screenshot from 2021-12-31 15-24-12
Screenshot from 2021-12-31 15-24-17
Screenshot from 2021-12-31 15-24-33

@uttu-parashar uttu-parashar changed the title getting errors in training and while inference the model getting errors in training and while inferencing the model Dec 31, 2021
@PattanaikL
Copy link
Owner

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?

@uttu-parashar
Copy link
Author

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.?

@forechoandlook
Copy link

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.

image

@uttu-parashar
Copy link
Author

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.

@uttu-parashar
Copy link
Author

uttu-parashar commented Jan 12, 2022

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.

@PattanaikL
Copy link
Owner

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

@uttu-parashar
Copy link
Author

uttu-parashar commented Feb 2, 2022

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 --

ss

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

@gcorso
Copy link

gcorso commented Feb 12, 2022

Any updates on this issue?

@PattanaikL
Copy link
Owner

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

@kiranfranklin999
Copy link

any update on this issue.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants