Massive speed increases and ram optimizations

This commit is contained in:
Jaret Burkett
2023-10-10 06:07:55 -06:00
parent f4c90bb589
commit 63ceffae24
7 changed files with 294 additions and 185 deletions

View File

@@ -448,7 +448,7 @@ class AiToolkitDataset(LatentCachingMixin, BucketsMixin, CaptionMixin, Dataset):
return len(self.file_list)
def _get_single_item(self, index) -> 'FileItemDTO':
file_item = self.file_list[index]
file_item = copy.deepcopy(self.file_list[index])
file_item.load_and_process_image(self.transform)
file_item.load_caption(self.caption_dict)
return file_item
@@ -529,14 +529,14 @@ def get_dataloader_from_datasets(
drop_last=False,
shuffle=True,
collate_fn=dto_collation, # Use the custom collate function
num_workers=0
num_workers=4
)
else:
data_loader = DataLoader(
concatenated_dataset,
batch_size=batch_size,
shuffle=True,
num_workers=0,
num_workers=4,
collate_fn=dto_collation
)
return data_loader