Compare commits

...

1 Commits

Author SHA1 Message Date
psychedelicious
b7d439c295 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`.
2024-10-15 17:00:08 +10:00

View File

@@ -184,7 +184,8 @@ class ModelInstallService(ModelInstallServiceBase):
) # 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)