Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(models): resolve relocated submodels from loaded root
wunianze666-netizen51cbddaa8d0a
diff --git a/invokeai/backend/model_manager/load/load_default.py b/invokeai/backend/model_manager/load/load_default.pyindex 506cc5f1b1..f590d19031 100644--- a/invokeai/backend/model_manager/load/load_default.py+++ b/invokeai/backend/model_manager/load/load_default.py@@ -73,7 +73,9 @@ def resolve_submodel_path(config: AnyModelConfig, submodel_type: SubModelType, fRemote installs discover components inside a ``tmpinstall_*`` directory before moving thepipeline into its permanent model directory. Existing records may therefore carry a discoveredpath whose root no longer exists. Discovery only records direct children of the pipeline, so in- that case rebase the recorded component name onto the current model root.+ that case rebase the recorded component name onto the current model root. Use the resolved+ fallback's parent for that root because managed model records persist ``config.path`` relative+ to the models directory.`fallback` is used when the config carries no such entry — configs persisted before submodeldiscovery existed, and the layouts where the component folder *is* the model path.@@ -83,7 +85,7 @@ def resolve_submodel_path(config: AnyModelConfig, submodel_type: SubModelType, freturn fallbackdiscovered_path = Path(discovered.path_or_prefix)- relocated_path = Path(config.path) / discovered_path.name+ relocated_path = fallback.parent / discovered_path.nameif not discovered_path.exists() and relocated_path.exists():return relocated_pathreturn discovered_pathdiff --git a/tests/backend/model_manager/load/test_load_default_helpers.py b/tests/backend/model_manager/load/test_load_default_helpers.pyindex 4e9d26d168..64da7900a3 100644--- a/tests/backend/model_manager/load/test_load_default_helpers.py+++ b/tests/backend/model_manager/load/test_load_default_helpers.py@@ -70,7 +70,9 @@ class TestResolveSubmodelPath:installed_root.parent.mkdir()staging_root.rename(installed_root)config = SimpleNamespace(- path=installed_root.as_posix(),+ # Managed model records store paths relative to the models directory. The loader's+ # fallback carries the resolved absolute model root.+ path=installed_root.name,submodels={SubModelType.TextEncoder: SimpleNamespace(path_or_prefix=discovered_component.as_posix())},)