From b524bf3c04145ae3a360174f540e625df3f57266 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Mon, 14 Aug 2023 07:37:47 -0400 Subject: [PATCH 1/2] allow symbolic links to be followed during autoimport --- invokeai/backend/model_management/model_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/backend/model_management/model_search.py b/invokeai/backend/model_management/model_search.py index 9c87d6c408..0a98091f4a 100644 --- a/invokeai/backend/model_management/model_search.py +++ b/invokeai/backend/model_management/model_search.py @@ -56,7 +56,7 @@ class ModelSearch(ABC): self.on_search_completed() def walk_directory(self, path: Path): - for root, dirs, files in os.walk(path): + for root, dirs, files in os.walk(path, followlinks=True): if str(Path(root).name).startswith("."): self._pruned_paths.add(root) if any([Path(root).is_relative_to(x) for x in self._pruned_paths]): From bc16b503023cac9857c4d3e228fc28cb41c87ab1 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 17 Aug 2023 18:54:18 -0400 Subject: [PATCH 2/2] add followlinks to all os.walk() calls --- invokeai/backend/install/migrate_to_3.py | 2 +- .../backend/stable_diffusion/image_degradation/utils_image.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/invokeai/backend/install/migrate_to_3.py b/invokeai/backend/install/migrate_to_3.py index 3f360f291d..0938ed2199 100644 --- a/invokeai/backend/install/migrate_to_3.py +++ b/invokeai/backend/install/migrate_to_3.py @@ -116,7 +116,7 @@ class MigrateTo3(object): appropriate location within the destination models directory. """ directories_scanned = set() - for root, dirs, files in os.walk(src_dir): + for root, dirs, files in os.walk(src_dir, followlinks=True): for d in dirs: try: model = Path(root, d) diff --git a/invokeai/backend/stable_diffusion/image_degradation/utils_image.py b/invokeai/backend/stable_diffusion/image_degradation/utils_image.py index d45ca602e6..fb71f85e5a 100644 --- a/invokeai/backend/stable_diffusion/image_degradation/utils_image.py +++ b/invokeai/backend/stable_diffusion/image_degradation/utils_image.py @@ -89,7 +89,7 @@ def get_image_paths(dataroot): def _get_paths_from_images(path): assert os.path.isdir(path), "{:s} is not a valid directory".format(path) images = [] - for dirpath, _, fnames in sorted(os.walk(path)): + for dirpath, _, fnames in sorted(os.walk(path, followlinks=True)): for fname in sorted(fnames): if is_image_file(fname): img_path = os.path.join(dirpath, fname)