Batch_to_atoms error

Hello OCP team,

I have a question about batch_to_atoms.
An error is occurring while performing =>
val_src = “data/s2ef/val_20”
val_dataset = LmdbDataset({“src”: val_src})
batch_to_atoms(val_dataset[0])

What is “neighbors”?
Thanks.


KeyError Traceback (most recent call last)
File c:\Miniconda\envs\ocp-models102\lib\site-packages\torch_geometric\data\storage.py:48, in BaseStorage.getattr(self, key)
47 try:
—> 48 return self[key]
49 except KeyError:

File c:\Miniconda\envs\ocp-models102\lib\site-packages\torch_geometric\data\storage.py:68, in BaseStorage.getitem(self, key)
67 def getitem(self, key: str) → Any:
—> 68 return self._mapping[key]

KeyError: ‘neighbors’

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
Input In [43], in <cell line: 3>()
1 val_src = “data/s2ef/val_20”
2 val_dataset = LmdbDataset({“src”: val_src})
----> 3 batch_to_atoms(val_dataset[0])

Input In [23], in batch_to_atoms(batch)
1 def batch_to_atoms(batch):
----> 2 n_systems = batch.neighbors.shape[0]
3 natoms = batch.natoms.tolist()
4 numbers = torch.split(batch.atomic_numbers, natoms)

File c:\Miniconda\envs\ocp-models102\lib\site-packages\torch_geometric\data\data.py:362, in Data.getattr(self, key)
356 if ‘_store’ not in self.dict:
357 raise RuntimeError(
358 "The ‘data’ object was created by an older version of PyG. "
359 "If this error occurred while loading an already existing "
360 "dataset, remove the ‘processed/’ directory in the dataset’s "
361 “root folder and try again.”)
→ 362 return getattr(self._store, key)

File c:\Miniconda\envs\ocp-models102\lib\site-packages\torch_geometric\data\storage.py:50, in BaseStorage.getattr(self, key)
48 return self[key]
49 except KeyError:
—> 50 raise AttributeError(
51 f"‘{self.class.name}’ object has no attribute ‘{key}’")

AttributeError: ‘GlobalStorage’ object has no attribute ‘neighbors’

neighbors is a Torch tensor of shape batch_size with the number of edges per graph in the batch. So neighbors.sum() == edge_index.shape[1]. These lines might be informative.

Thank you very much for your reply.
I understand the content.

1 Like