From b7d439c29596c1f5f73c281d3069be1bf0cc22fe Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:00:08 +1000 Subject: [PATCH] fix(mm): model names with periods borked When we provide a config object during a model install, the config can override individual fields that would otherwise be derived programmatically. We use this to install starter models w/ a given name, description, etc. This logic used `pathlib` to append a suffix to the model's name. When we provide a model name that has a period in it, `pathlib` splits the name at the period and replaces everything after it with the suffix. This is then used to determine the output path of the model. As a result, some starter model paths are incorrect. For example, `IP Adapter SD1.5 Image Encoder` gets installed to `sd-1/clip_vision/IP Adapter SD1`. --- invokeai/app/services/model_install/model_install_default.py | 3 ++- 1 file changed, 2 insertions(+), 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 4ff48034385..0fd9871a7a9 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -184,7 +184,8 @@ def install_path( ) # type: ignore if preferred_name := config.name: - preferred_name = Path(preferred_name).with_suffix(model_path.suffix) + if model_path.suffix: + preferred_name = f"{preferred_name}.{model_path.suffix}" dest_path = ( self.app_config.models_path / info.base.value / info.type.value / (preferred_name or model_path.name)