mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
move incorrectly placed models into correct directory at startup time
This commit is contained in:
@ -8,7 +8,7 @@ from invokeai.app.services.config import InvokeAIAppConfig
|
||||
|
||||
def check_invokeai_root(config: InvokeAIAppConfig):
|
||||
try:
|
||||
assert config.model_conf_path.exists(), f"{config.model_conf_path} not found"
|
||||
assert config.model_conf_path.parent.exists(), f"{config.model_conf_path.parent} not found"
|
||||
assert config.db_path.parent.exists(), f"{config.db_path.parent} not found"
|
||||
assert config.models_path.exists(), f"{config.models_path} not found"
|
||||
if not config.ignore_missing_core_models:
|
||||
|
@ -529,6 +529,9 @@ class ModelInstall(ModelInstallBase):
|
||||
return old_path
|
||||
|
||||
new_path = models_dir / model.base_model.value / model.model_type.value / model.name
|
||||
self._logger.info(
|
||||
f"{old_path.name} is not in the right directory for a model of its type. Moving to {new_path}."
|
||||
)
|
||||
model.path = self._move_model(old_path, new_path).as_posix()
|
||||
self._store.update_model(key, model)
|
||||
return model
|
||||
@ -652,7 +655,8 @@ class ModelInstall(ModelInstallBase):
|
||||
def _scan_register(self, model: Path) -> bool:
|
||||
try:
|
||||
id = self.register_path(model)
|
||||
self._logger.info(f"Registered {model} with id {id}")
|
||||
self.sync_model_path(id) # possibly move it to right place in `models`
|
||||
self._logger.info(f"Registered {model.name} with id {id}")
|
||||
self._installed.add(id)
|
||||
except DuplicateModelException:
|
||||
pass
|
||||
|
Reference in New Issue
Block a user