From 7ff2371c077ce639d995de0c87c87207d377e6c4 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:42:16 +1100 Subject: [PATCH] fix(mm): do not rename model file if model record is renamed Renaming the model file to the model name introduces unnecessary contraints on model names. For example, a model name can technically be any length, but a model _filename_ cannot be too long. There are also constraints on valid characters for filenames which shouldn't be applied to model record names. I believe the old behaviour is a holdover from the old system. --- 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 b557797a4b..b5595d18c6 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -564,7 +564,7 @@ class ModelInstallService(ModelInstallServiceBase): # The model is not in the models directory - we don't need to move it. return model - new_path = (models_dir / model.base.value / model.type.value / model.name).with_suffix(old_path.suffix) + new_path = models_dir / model.base.value / model.type.value / old_path.name if old_path == new_path or new_path.exists() and old_path == new_path.resolve(): return model