From aa25ea62a50a578ab063b3e8cccdd41a5e144933 Mon Sep 17 00:00:00 2001 From: Neil Wang <39628660+isNeil@users.noreply.github.com> Date: Thu, 18 Jan 2024 21:53:53 +0000 Subject: [PATCH] fix(backend) installed models being redownloaded (#5526) * fix * fix ruff errors --------- Co-authored-by: Lincoln Stein --- invokeai/backend/install/model_install_backend.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/invokeai/backend/install/model_install_backend.py b/invokeai/backend/install/model_install_backend.py index afbcc848d8..2ffc1e6ff4 100644 --- a/invokeai/backend/install/model_install_backend.py +++ b/invokeai/backend/install/model_install_backend.py @@ -283,11 +283,16 @@ class ModelInstall(object): def _remove_installed(self, model_list: List[str]): all_models = self.all_models() + models_to_remove = [] + for path in model_list: key = self.reverse_paths.get(path) if key and all_models[key].installed: - logger.warning(f"{path} already installed. Skipping.") - model_list.remove(path) + models_to_remove.append(path) + + for path in models_to_remove: + logger.warning(f"{path} already installed. Skipping") + model_list.remove(path) def _add_required_models(self, model_list: List[str]): additional_models = []