From 93aed57e810524a24a56b1dae4bc32c2a4ca6d0f Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:08:24 +1100 Subject: [PATCH] fix(mm): use UUIDv4 for key This changes the functionality of this PR to only use the updated hashing for model hashes with a UUID for the key. --- invokeai/app/services/model_install/model_install_default.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 51c4878709..b3c6015f4d 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -20,6 +20,7 @@ from invokeai.app.services.download import DownloadJob, DownloadQueueServiceBase from invokeai.app.services.events.events_base import EventServiceBase from invokeai.app.services.invoker import Invoker from invokeai.app.services.model_records import DuplicateModelException, ModelRecordServiceBase +from invokeai.app.util.misc import uuid_string from invokeai.backend.model_manager.config import ( AnyModelConfig, BaseModelType, @@ -149,7 +150,7 @@ class ModelInstallService(ModelInstallServiceBase): config = config or {} if not config.get("source"): config["source"] = model_path.resolve().as_posix() - config["key"] = config.get("key", self._create_key()) + config["key"] = config.get("key", uuid_string()) info: AnyModelConfig = self._probe_model(Path(model_path), config) @@ -530,7 +531,7 @@ class ModelInstallService(ModelInstallServiceBase): ) -> str: # Note that we may be passed a pre-populated AnyModelConfig object, # in which case the key field should have been populated by the caller (e.g. in `install_path`). - config["key"] = config.get("key", self._create_key()) + config["key"] = config.get("key", uuid_string()) info = info or ModelProbe.probe(model_path, config) override_key: Optional[str] = config.get("key") if config else None