Skip to content
Snippets Groups Projects
Commit 6b6196a0 authored by Daniel CARRON's avatar Daniel CARRON :b:
Browse files

Apply transforms during __getitem__ in CachedDataset

parent 47fd5c21
No related branches found
No related tags found
No related merge requests found
Pipeline #75342 failed
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
...@@ -333,12 +333,12 @@ class CachedDataset(torch.utils.data.Dataset): ...@@ -333,12 +333,12 @@ class CachedDataset(torch.utils.data.Dataset):
logger.info(f"Caching {self.subset} samples") logger.info(f"Caching {self.subset} samples")
for sample in tqdm(self._samples): for sample in tqdm(self._samples):
sample["data"] = self.transforms( sample["data"] = self.raw_data_loader(sample["data"])
self.raw_data_loader(sample["data"])
)
def __getitem__(self, idx): def __getitem__(self, idx):
return self._samples[idx] sample = self._samples[idx].copy()
sample["data"] = self.transforms(sample["data"])
return sample
def __len__(self): def __len__(self):
return len(self._samples) return len(self._samples)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment