From 52872d383940903625906dacae3850ad91d85a9d Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:52:45 +1100 Subject: [PATCH 1/2] fix(mm): fix `models.yaml` backup filename Was erroneously `models.bak`, now `models.yaml.bak` --- invokeai/app/services/model_install/model_install_default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 6f854f8730..754107a438 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -329,7 +329,7 @@ def _migrate_yaml(self) -> None: # Rename `models.yaml` to `models.yaml.bak` to prevent re-migration yaml_path = self._app_config.model_conf_path - yaml_path.rename(yaml_path.with_suffix(".bak")) + yaml_path.rename(yaml_path.with_suffix(".yaml.bak")) def scan_directory(self, scan_dir: Path, install: bool = False) -> List[str]: # noqa D102 self._cached_model_paths = {Path(x.path).absolute() for x in self.record_store.all_models()} From 1cfe56aac91f9c96ae84496a28af5e0132993c90 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:54:51 +1100 Subject: [PATCH 2/2] fix(mm): models lose file extension when syncing We were stripping the file extension from file models when moving them in `_sync_model_path`. For example, `some_model.safetensors` would be moved to `some_model`, which of course breaks things. Instead of using the model's name as the new path, use the model's path's last segment. This is the same behaviour for directories, but for files, it retains the file extension. --- invokeai/app/services/model_install/model_install_default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 754107a438..8c8f74012b 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -520,7 +520,7 @@ def _sync_model_path(self, key: str) -> AnyModelConfig: except ValueError: pass - new_path = models_dir / model.base.value / model.type.value / model.name + new_path = models_dir / model.base.value / model.type.value / old_path.name if old_path == new_path: return model