From 0f02a72cb9fe9d7ac8a7e4be142737ab7a6b6c26 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Fri, 22 Mar 2024 19:41:34 -0400 Subject: [PATCH] allow deletion of symlinked models in models dir --- .../app/services/model_install/model_install_default.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 755e5f7685..04d2d5fd39 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -390,10 +390,10 @@ class ModelInstallService(ModelInstallServiceBase): def unconditionally_delete(self, key: str) -> None: # noqa D102 model = self.record_store.get_model(key) model_path = self.app_config.models_path / model.path - if model_path.is_dir(): - rmtree(model_path) - else: + if model_path.is_file() or model_path.is_symlink(): model_path.unlink() + elif model_path.is_dir(): + rmtree(model_path) self.unregister(key) def download_and_cache(