From 6e2cef1db5e8f3c839ce9d0a0a448b43c7b6e3b7 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Thu, 7 Mar 2024 19:23:49 -0500 Subject: [PATCH] Remove instances making models relative to the model dir --- .../app/services/model_install/model_install_default.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 7a69368732..44920cc023 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -493,7 +493,7 @@ class ModelInstallService(ModelInstallServiceBase): self._logger.info(f"Scanning {self._app_config.models_path} for new and orphaned models") for cur_base_model in BaseModelType: for cur_model_type in ModelType: - models_dir = Path(cur_base_model.value, cur_model_type.value) + models_dir = self._app_config.models_path / Path(cur_base_model.value, cur_model_type.value) installed.update(self.scan_directory(models_dir)) self._logger.info(f"{len(installed)} new models registered; {len(defunct_models)} unregistered") @@ -518,7 +518,7 @@ class ModelInstallService(ModelInstallServiceBase): new_path = models_dir / model.base.value / model.type.value / model.name self._logger.info(f"Moving {model.name} to {new_path}.") new_path = self._move_model(old_path, new_path) - model.path = new_path.relative_to(models_dir).as_posix() + model.path = new_path.as_posix() self.record_store.update_model(key, ModelRecordChanges(path=model.path)) return model @@ -581,9 +581,6 @@ class ModelInstallService(ModelInstallServiceBase): info = info or ModelProbe.probe(model_path, config) - if not model_path.is_absolute(): - model_path = (self._app_config.models_path / model_path) - model_path = model_path.resolve() info.path = model_path.as_posix()