From c5d6b74feafe5b2aa957c8407c4f806293432c5e Mon Sep 17 00:00:00 2001 From: Hameer Abbasi <2190658+hameerabbasi@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:47:26 +0200 Subject: [PATCH 1/2] Fix caption loading. --- toolkit/dataloader_mixins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/dataloader_mixins.py b/toolkit/dataloader_mixins.py index 5f419ff0..4b1e86d4 100644 --- a/toolkit/dataloader_mixins.py +++ b/toolkit/dataloader_mixins.py @@ -315,7 +315,7 @@ class CaptionProcessingDTOMixin: # see if prompt file exists path_no_ext = os.path.splitext(self.path)[0] prompt_ext = self.dataset_config.caption_ext - prompt_path = f"{path_no_ext}.{prompt_ext}" + prompt_path = path_no_ext + prompt_ext short_caption = None if os.path.exists(prompt_path): From 5e86139e0a996ddc0a90279be3a227e6f30e51cc Mon Sep 17 00:00:00 2001 From: Hameer Abbasi <2190658+hameerabbasi@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:07:20 +0200 Subject: [PATCH 2/2] Fix `NameError`. --- toolkit/dataloader_mixins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/dataloader_mixins.py b/toolkit/dataloader_mixins.py index 4b1e86d4..5a6aa239 100644 --- a/toolkit/dataloader_mixins.py +++ b/toolkit/dataloader_mixins.py @@ -111,12 +111,12 @@ class CaptionMixin: if not hasattr(self, 'file_list'): raise Exception('file_list not found on class instance') img_path_or_tuple = self.file_list[index] + ext = self.dataset_config.caption_ext if isinstance(img_path_or_tuple, tuple): img_path = img_path_or_tuple[0] if isinstance(img_path_or_tuple[0], str) else img_path_or_tuple[0].path # check if either has a prompt file path_no_ext = os.path.splitext(img_path)[0] prompt_path = None - ext = self.dataset_config.caption_ext prompt_path = path_no_ext + ext else: img_path = img_path_or_tuple if isinstance(img_path_or_tuple, str) else img_path_or_tuple.path