mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Retain suffix (.safetensors, .bin) when renaming a checkpoint file or LoRA
- closes #5518
This commit is contained in:
parent
2953dea4a0
commit
bd31b5606c
@ -759,7 +759,7 @@ class ModelManager(object):
|
||||
model_type: ModelType,
|
||||
new_name: Optional[str] = None,
|
||||
new_base: Optional[BaseModelType] = None,
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Rename or rebase a model.
|
||||
"""
|
||||
@ -781,6 +781,9 @@ class ModelManager(object):
|
||||
|
||||
# if this is a model file/directory that we manage ourselves, we need to move it
|
||||
if old_path.is_relative_to(self.app_config.models_path):
|
||||
# keep the suffix!
|
||||
if old_path.is_file():
|
||||
new_name = Path(new_name).with_suffix(old_path.suffix).as_posix()
|
||||
new_path = self.resolve_model_path(
|
||||
Path(
|
||||
BaseModelType(new_base).value,
|
||||
|
Loading…
Reference in New Issue
Block a user