From e05317e13dae0b536155dcd540b55c0ac066b6c9 Mon Sep 17 00:00:00 2001 From: BitcrushedHeart Date: Tue, 10 Feb 2026 19:36:20 +0000 Subject: [PATCH 1/3] Skip dot-directories when scanning subdirectories Excludes directories starting with '.' (e.g. .trash, .ignore, .git) from subdirectory scanning in concept stats, image preview, and concept list. Also updates mgds dependency to include the same fix in the training data loader. --- modules/ui/ConceptTab.py | 2 ++ modules/ui/ConceptWindow.py | 4 +++- modules/util/concept_stats.py | 4 ++-- requirements-global.txt | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/ui/ConceptTab.py b/modules/ui/ConceptTab.py index a3806c15d..9774d324e 100644 --- a/modules/ui/ConceptTab.py +++ b/modules/ui/ConceptTab.py @@ -257,6 +257,8 @@ def __get_preview_image(self): concept_path = ConceptWindow.get_concept_path(getattr(self.concept, 'path', None)) if concept_path: for path in pathlib.Path(concept_path).glob(glob_pattern): + if any(part.startswith('.') for part in path.relative_to(concept_path).parts): + continue extension = os.path.splitext(path)[1] if (path.is_file() and path_util.is_supported_image_extension(extension) diff --git a/modules/ui/ConceptWindow.py b/modules/ui/ConceptWindow.py index 60b195c75..01f858c40 100644 --- a/modules/ui/ConceptWindow.py +++ b/modules/ui/ConceptWindow.py @@ -610,6 +610,8 @@ def __get_preview_image(self): concept_path = self.get_concept_path(self.concept.path) if concept_path: for path in pathlib.Path(concept_path).glob(glob_pattern): + if any(part.startswith('.') for part in path.relative_to(concept_path).parts): + continue extension = os.path.splitext(path)[1] if path.is_file() and path_util.is_supported_image_extension(extension) \ and not path.name.endswith("-masklabel.png") and not path.name.endswith("-condlabel.png"): @@ -883,7 +885,7 @@ def __get_concept_stats(self, advanced_checks: bool, wait_time: float): break stats_dict = concept_stats.folder_scan(path, stats_dict, advanced_checks, self.concept, start_time, wait_time, self.cancel_scan_flag) if self.concept.include_subdirectories and not self.cancel_scan_flag.is_set(): #add all subfolders of current directory to for loop - subfolders.extend([f for f in os.scandir(path) if f.is_dir()]) + subfolders.extend([f for f in os.scandir(path) if f.is_dir() and not f.name.startswith('.')]) self.concept.concept_stats = stats_dict #update GUI approx every half second if time.perf_counter() > (last_update + 0.5): diff --git a/modules/util/concept_stats.py b/modules/util/concept_stats.py index f0abb30a6..9e0f31cef 100644 --- a/modules/util/concept_stats.py +++ b/modules/util/concept_stats.py @@ -285,7 +285,7 @@ def subfolder_scan(conceptconfig : ConceptConfig, advanced_checks : bool, wait_t for dir in subfolders: stats_dict = folder_scan(dir, stats_dict, advanced_checks, start_time, wait_time, cancel_scan_flag) - subfolders.extend([f for f in os.scandir(dir) if f.is_dir()]) + subfolders.extend([f for f in os.scandir(dir) if f.is_dir() and not f.name.startswith('.')]) return stats_dict @@ -302,7 +302,7 @@ def subfolder_scan_threaded(conceptconfig : ConceptConfig, advanced_checks : boo stats_futures = [] for dir in subfolders: stats_futures += [executor.submit(folder_scan, dir, init_concept_stats(advanced_checks), advanced_checks, start_time, wait_time, cancel_scan_flag)] - subfolders.extend([f.path for f in os.scandir(dir) if f.is_dir()]) + subfolders.extend([f.path for f in os.scandir(dir) if f.is_dir() and not os.path.basename(f.path).startswith('.')]) stats_results = [f.result() for f in stats_futures] final_stats = combine_stats_dicts(stats_results, conceptconfig, advanced_checks) diff --git a/requirements-global.txt b/requirements-global.txt index 26a4b4cec..c9ff26555 100644 --- a/requirements-global.txt +++ b/requirements-global.txt @@ -32,7 +32,7 @@ pooch==1.8.2 open-clip-torch==2.32.0 # data loader --e git+https://github.com/Nerogar/mgds.git@a0c84a3#egg=mgds +-e git+https://github.com/BitcrushedHeart/mgds.git@e4bfa65#egg=mgds # optimizers dadaptation==3.2 # dadaptation optimizers From 0225212eb124b8ba73ac71be3d1cf629acacb1a0 Mon Sep 17 00:00:00 2001 From: BitcrushedHeart <215311041+BitcrushedHeart@users.noreply.github.com> Date: Sun, 22 Feb 2026 10:33:50 +0000 Subject: [PATCH 2/3] Only skip dot-directories, not dot-files, to match mgds behavior --- modules/ui/ConceptTab.py | 2 +- modules/ui/ConceptWindow.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ui/ConceptTab.py b/modules/ui/ConceptTab.py index 9774d324e..1ed0ac6c0 100644 --- a/modules/ui/ConceptTab.py +++ b/modules/ui/ConceptTab.py @@ -257,7 +257,7 @@ def __get_preview_image(self): concept_path = ConceptWindow.get_concept_path(getattr(self.concept, 'path', None)) if concept_path: for path in pathlib.Path(concept_path).glob(glob_pattern): - if any(part.startswith('.') for part in path.relative_to(concept_path).parts): + if any(part.startswith('.') for part in path.relative_to(concept_path).parent.parts): continue extension = os.path.splitext(path)[1] if (path.is_file() diff --git a/modules/ui/ConceptWindow.py b/modules/ui/ConceptWindow.py index 01f858c40..f3cd8efa5 100644 --- a/modules/ui/ConceptWindow.py +++ b/modules/ui/ConceptWindow.py @@ -610,7 +610,7 @@ def __get_preview_image(self): concept_path = self.get_concept_path(self.concept.path) if concept_path: for path in pathlib.Path(concept_path).glob(glob_pattern): - if any(part.startswith('.') for part in path.relative_to(concept_path).parts): + if any(part.startswith('.') for part in path.relative_to(concept_path).parent.parts): continue extension = os.path.splitext(path)[1] if path.is_file() and path_util.is_supported_image_extension(extension) \ From ae1ca14b241ffdf3d1094b6d2ff6f4438fad84b1 Mon Sep 17 00:00:00 2001 From: dxqb <183307934+dxqb@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:20:30 +0100 Subject: [PATCH 3/3] Update mgds repository link in requirements --- requirements-global.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-global.txt b/requirements-global.txt index c9ff26555..19d55bee8 100644 --- a/requirements-global.txt +++ b/requirements-global.txt @@ -32,7 +32,7 @@ pooch==1.8.2 open-clip-torch==2.32.0 # data loader --e git+https://github.com/BitcrushedHeart/mgds.git@e4bfa65#egg=mgds +-e git+https://github.com/Nerogar/mgds.git@@5bbafa5#egg=mgds # optimizers dadaptation==3.2 # dadaptation optimizers