improve memory consumption by clearing cache + move image to cpu (#412)

* reduced mem on train; figuring out memory leak on visualizer

* steadily below 10G memory

* cpu loading image

* update docstrings

* added scrolling

* Revert "update docstrings"

This reverts commit a914387cf8.

* Revert "Revert "update docstrings""

This reverts commit 177c3dd6f1.

* Revert "added scrolling"

This reverts commit f37351ee7f.
This commit is contained in:
evonneng authored and GitHub committed 2022-09-12 23:00:44 -07:00
1 parent 54f7affe02
commit 4801a99b2a
11 files changed
+22 -12

No files matched your search

+2
View File
@@ -251,6 +251,8 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
self.train_input_dataset,
num_images_to_sample_from=self.config.train_num_images_to_sample_from,
device=self.device,
num_workers=self.world_size * 4,
pin_memory=True,
)
self.iter_train_image_dataloader = iter(self.train_image_dataloader)
self.train_pixel_sampler = PixelSampler(self.config.train_num_rays_per_batch)
+2 -2
View File
@@ -77,7 +77,7 @@ class CacheImageDataloader(DataLoader):
"""Returns a collated batch."""
batch_list = self._get_batch_list()
collated_batch = default_collate(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
def __iter__(self):
@@ -162,7 +162,7 @@ class EvalDataloader(DataLoader):
ray_bundle.num_rays_per_chunk = self.num_rays_per_chunk
ray_bundle.camera_indices = torch.Tensor([image_idx])[..., None].int()
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