From d8da85b38bcc70cd4d9381a10586b1e1f580493e Mon Sep 17 00:00:00 2001 From: Gaetano Bonofiglio Date: Mon, 9 Jan 2023 11:40:00 +0100 Subject: [PATCH 1/2] fix file not found when `[` is in the filename --- library/train_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/train_util.py b/library/train_util.py index bad954c2..fcd9880d 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -715,7 +715,7 @@ def debug_dataset(train_dataset): def glob_images(dir, base): img_paths = [] for ext in IMAGE_EXTENSIONS: - img_paths.extend(glob.glob(os.path.join(dir, base + ext))) + img_paths.extend(glob.glob(glob.escape(os.path.join(dir, base + ext)))) return img_paths # endregion From 673f9ced4792607724669fd7edefcc11f3c6cddb Mon Sep 17 00:00:00 2001 From: Kohya S Date: Mon, 9 Jan 2023 21:06:58 +0900 Subject: [PATCH 2/2] Fix '*' is not working for DreamBooth --- library/train_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/train_util.py b/library/train_util.py index fcd9880d..7a0f794b 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -715,7 +715,10 @@ def debug_dataset(train_dataset): def glob_images(dir, base): img_paths = [] for ext in IMAGE_EXTENSIONS: - img_paths.extend(glob.glob(glob.escape(os.path.join(dir, base + ext)))) + if base == '*': + img_paths.extend(glob.glob(os.path.join(glob.escape(dir), base + ext))) + else: + img_paths.extend(glob.glob(glob.escape(os.path.join(dir, base + ext)))) return img_paths # endregion