diff --git a/invokeai/app/services/config/config_default.py b/invokeai/app/services/config/config_default.py index 3730b3508d..10d8ba308f 100644 --- a/invokeai/app/services/config/config_default.py +++ b/invokeai/app/services/config/config_default.py @@ -436,6 +436,11 @@ def get_config() -> InvokeAIAppConfig: args = InvokeAIArgs.args + # This flag serves as a proxy for whether the config was retrieved in the context of the full application or not. + # If it is False, we should just return a default config and not set the root, log in to HF, etc. + if not InvokeAIArgs.did_parse: + return config + # CLI args trump environment variables if root := getattr(args, "root", None): config.set_root(Path(root)) diff --git a/invokeai/frontend/cli/arg_parser.py b/invokeai/frontend/cli/arg_parser.py index 7db06fddd9..34f7c462bb 100644 --- a/invokeai/frontend/cli/arg_parser.py +++ b/invokeai/frontend/cli/arg_parser.py @@ -34,9 +34,11 @@ class InvokeAIArgs: """ args: Optional[Namespace] = None + did_parse: bool = False @staticmethod def parse_args() -> Optional[Namespace]: """Parse CLI args and store the result.""" InvokeAIArgs.args = _parser.parse_args() + InvokeAIArgs.did_parse = True return InvokeAIArgs.args