From b3248a8eefe066e6502b535a19501363ec352974 Mon Sep 17 00:00:00 2001 From: feffy380 <114889020+feffy380@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:31:05 +0100 Subject: [PATCH] fix: sort order when getting image size from cache file --- 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 18d3cf6c2..8b5cf214e 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -1887,7 +1887,7 @@ def load_dreambooth_dir(subset: DreamBoothSubset): # make image path to npz path mapping npz_paths = glob.glob(os.path.join(subset.image_dir, "*" + strategy.cache_suffix)) - npz_paths.sort() + npz_paths.sort(key=lambda item: item.rsplit("_", maxsplit=2)[0]) # sort by name excluding resolution and cache_suffix npz_path_index = 0 size_set_count = 0