maho3 / ltu-ili

Robust ML in Astro
https://ltu-ili.readthedocs.io/en/latest/
46 stars 9 forks source link

Bug found in the get_all_data() and get_all_parameter() functions #164

Closed oscar-macias closed 1 month ago

oscar-macias commented 4 months ago

Dear All - Thank you very much for your great work!

I can run the tutorial ltu-ili/notebooks/lampe.ipynb without any issues, but when I reach the validation steps:

x = loader.get_all_data() y = loader.get_all_parameters() I get the following bug:


AttributeError Traceback (most recent call last) Cell In[17], line 1 ----> 1 x = loader.get_all_data() 2 y = loader.get_all_parameters()

File ~/src/ltu-ili/ili/dataloaders/loaders.py:519, in TorchLoader.get_all_data(self) 512 def get_all_data(self) -> Tensor: 513 """Returns all the loaded data for training. 514 May need to be redefined for complex dataloaders. 515 516 Returns: 517 Tensor: data 518 """ --> 519 return self.train_loader.dataset.tensors[0]

File ~/miniconda3/envs/ili-torch/lib/python3.10/site-packages/torch_geometric/data/in_memory_dataset.py:318, in InMemoryDataset.getattr(self, key) 315 data_list = [self.get(i) for i in self.indices()] 316 return Batch.from_data_list(data_list)[key] --> 318 raise AttributeError(f"'{self.class.name}' object has no " 319 f"attribute '{key}'")

AttributeError: 'QM7b' object has no attribute 'tensors'

The same issue occurs with my custom-made data for my LtU-ILI project. Could you please suggest a solution?

Thank you very much and best regards, Oscar.

maho3 commented 1 month ago

Hi @oscar-macias, I forgot to follow up on this! Were you able to come up with a solution here?

oscar-macias commented 1 month ago

Hi @maho3, Thank you for your message! Sure, it's no problem; I managed to figure this out!