cdvae icon indicating copy to clipboard operation
cdvae copied to clipboard

Problem with the reconstruction task

Open ubikpt opened this issue 3 years ago • 6 comments

Hello, this software looks great!

However, I am having problems when I try to run the reconstruction task, I get the error below. I traced the error and did some printouts and the error seems to occur when the program tries to process the attribute (attr) num_atoms with value tensor([5] , device='cuda:0')

Any clues on what can be the problem would be very appreciated.

Best regards, Luis

Traceback (most recent call last): File "scripts/evaluate.py", line 280, in main(args) File "scripts/evaluate.py", line 194, in main all_frac_coords_stack, all_atom_types_stack, input_data_batch) = reconstructon( File "scripts/evaluate.py", line 69, in reconstructon input_data_list = input_data_list + batch.to_data_list() File "/home/chemist/.conda/envs/cdvae/lib/python3.8/site-packages/torch_geometric/data/batch.py", line 157, in to_data_list return [self.get(i) for i in range(self.num_graphs)] File "/home/chemist/.conda/envs/cdvae/lib/python3.8/site-packages/torch_geometric/data/batch.py", line 157, in return [self.get(i) for i in range(self.num_graphs)] File "/home/chemist/.conda/envs/cdvae/lib/python3.8/site-packages/torch_geometric/data/batch.py", line 90, in get data = separate( File "/home/chemist/.conda/envs/cdvae/lib/python3.8/site-packages/torch_geometric/data/separate.py", line 57, in separate data_store[attr] = _separate(attr, batch_store[attr], idx, slices, File "/home/chemist/.conda/envs/cdvae/lib/python3.8/site-packages/torch_geometric/data/separate.py", line 116, in _separate if decrement and (incs.dim() > 1 or int(incs[idx]) != 0): AttributeError: 'NoneType' object has no attribute 'dim'

ubikpt avatar Feb 15 '22 08:02 ubikpt

Thanks Luis! This is a strange error.

input_data_list = input_data_list + batch.to_data_list()

This line simply reads test data and save them into a list. So it should work as long as you can load test data during training.

One possibility is that the last batch only has 1 data point. batch.num_atoms is squeezed to a zero-dim tensor somewhere. I never see this error myself so I am not sure.

txie-93 avatar Feb 15 '22 19:02 txie-93

Thank you very much for your quick reply ! Yes, it's strange, I installed the prerequisites using conda as recommended. I'm testing the program with the data provided in the repository (perov). I did some small changes in the config file though: reduced the train batch size to 256 (because I got a CUDA out of memory error) and changed num_workers to 6. Do you think the problem can be related to this?

ubikpt avatar Feb 16 '22 00:02 ubikpt

Additional information ... Using the same model, I managed to run the generation task without crashing. I don't know if this can be useful, but this is information about the batch which is causing me trouble in the reconstruction task. Do you notice something strange here?

Batch(edge_index=[2, 8088], y=[256, 1], frac_coords=[1280, 3], atom_types=[1280], lengths=[256, 3], angles=[256, 3], to_jimages=[8088, 3], num_atoms=[256], num_bonds=[256], num_nodes=1280, batch=[1280], ptr=[257])

ubikpt avatar Feb 16 '22 08:02 ubikpt

Thanks for sharing the additional information! I was able to reproduce the error and looked little into it. I now suspect this is because pytorch geometric had some breaking changes to their Batch class in v2.0. The code was developed in pytorch geometric v1.7.0. I am now trying to see if the error disappear with a lower version of pytorch geometric.

txie-93 avatar Feb 16 '22 19:02 txie-93

I had the same error and things are working fine for me on v1.7.0. Thanks @txie-93!

AdeeshKolluru avatar Feb 21 '22 14:02 AdeeshKolluru

Yep, this also worked for me... Thanks !

ubikpt avatar Feb 25 '22 06:02 ubikpt