Memory optimizations. Default to using cudamalloc when torch 2.0 for mem allocation

This commit is contained in:
Jaret Burkett
2023-09-12 04:30:23 -06:00
parent e8583860ad
commit d74dd636ee
5 changed files with 104 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ class FileItemDTO(LatentCachingFileItemDTOMixin, CaptionProcessingDTOMixin, Imag
self.tensor: Union[torch.Tensor, None] = None
def cleanup(self):
self.tensor = None
del self.tensor
self.cleanup_latent()
@@ -90,7 +90,7 @@ class DataLoaderBatchDTO:
) for x in self.file_items]
def cleanup(self):
self.tensor = None
del self.latents
del self.tensor
for file_item in self.file_items:
file_item.cleanup()
del self.tensor