Avoid loading entire dataset on GPU (#1551)

This commit is contained in:
Matthew Tancik authored and GitHub committed 2023-03-02 14:32:27 -08:00
1 parent a36f33c5ee
commit 8d41e522e3
1 file changed
+2 -2
+2 -2
View File
@@ -116,7 +116,7 @@ class CacheDataloader(DataLoader):
"""Returns a collated batch.""" """Returns a collated batch."""
batch_list = self._get_batch_list() batch_list = self._get_batch_list()
collated_batch = self.collate_fn(batch_list) collated_batch = self.collate_fn(batch_list)
collated_batch = get_dict_to_torch(collated_batch, device=self.device) collated_batch = get_dict_to_torch(collated_batch, device=self.device, exclude=["image"])
return collated_batch return collated_batch
def __iter__(self): def __iter__(self):
@@ -183,7 +183,7 @@ class EvalDataloader(DataLoader):
""" """
ray_bundle = self.cameras.generate_rays(camera_indices=image_idx, keep_shape=True) ray_bundle = self.cameras.generate_rays(camera_indices=image_idx, keep_shape=True)
batch = self.input_dataset[image_idx] batch = self.input_dataset[image_idx]
batch = get_dict_to_torch(batch, device=self.device) batch = get_dict_to_torch(batch, device=self.device, exclude=["image"])
return ray_bundle, batch return ray_bundle, batch