diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 81836f7fde..3c236684e8 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -7,7 +7,7 @@ import threading import time from pathlib import Path from queue import Empty, Queue -from shutil import copyfile, copytree, move, rmtree +from shutil import move, rmtree from tempfile import mkdtemp from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union @@ -193,7 +193,7 @@ class ModelInstallService(ModelInstallServiceBase): self.app_config.models_path / info.base.value / info.type.value / (preferred_name or model_path.name) ) try: - new_path = self._copy_model(model_path, dest_path) + new_path = self._move_model(model_path, dest_path) except FileExistsError as excp: raise DuplicateModelException( f"A model named {model_path.name} is already installed at {dest_path.as_posix()}" @@ -618,16 +618,6 @@ class ModelInstallService(ModelInstallServiceBase): self.record_store.update_model(key, ModelRecordChanges(path=model.path)) return model - def _copy_model(self, old_path: Path, new_path: Path) -> Path: - if old_path == new_path: - return old_path - new_path.parent.mkdir(parents=True, exist_ok=True) - if old_path.is_dir(): - copytree(old_path, new_path) - else: - copyfile(old_path, new_path) - return new_path - def _move_model(self, old_path: Path, new_path: Path) -> Path: if old_path == new_path: return old_path