1
- import uvicorn
2
-
3
- from invokeai .app .invocations .load_custom_nodes import load_custom_nodes
4
- from invokeai .app .services .config .config_default import get_config
5
- from invokeai .app .util .torch_cuda_allocator import configure_torch_cuda_allocator
6
- from invokeai .backend .util .logging import InvokeAILogger
7
- from invokeai .frontend .cli .arg_parser import InvokeAIArgs
8
-
9
-
10
1
def get_app ():
11
2
"""Import the app and event loop. We wrap this in a function to more explicitly control when it happens, because
12
3
importing from api_app does a bunch of stuff - it's more like calling a function than importing a module.
@@ -18,9 +9,20 @@ def get_app():
18
9
19
10
def run_app () -> None :
20
11
"""The main entrypoint for the app."""
21
- # Parse the CLI arguments.
12
+ from invokeai .frontend .cli .arg_parser import InvokeAIArgs
13
+
14
+ # Parse the CLI arguments before doing anything else, which ensures CLI args correctly override settings from other
15
+ # sources like `invokeai.yaml` or env vars.
22
16
InvokeAIArgs .parse_args ()
23
17
18
+ import uvicorn
19
+
20
+ from invokeai .app .invocations .baseinvocation import InvocationRegistry
21
+ from invokeai .app .invocations .load_custom_nodes import load_custom_nodes
22
+ from invokeai .app .services .config .config_default import get_config
23
+ from invokeai .app .util .torch_cuda_allocator import configure_torch_cuda_allocator
24
+ from invokeai .backend .util .logging import InvokeAILogger
25
+
24
26
# Load config.
25
27
app_config = get_config ()
26
28
@@ -66,6 +68,15 @@ def run_app() -> None:
66
68
# core nodes have been imported so that we can catch when a custom node clobbers a core node.
67
69
load_custom_nodes (custom_nodes_path = app_config .custom_nodes_path , logger = logger )
68
70
71
+ # Check all invocations and ensure their outputs are registered.
72
+ for invocation in InvocationRegistry .get_invocation_classes ():
73
+ invocation_type = invocation .get_type ()
74
+ output_annotation = invocation .get_output_annotation ()
75
+ if output_annotation not in InvocationRegistry .get_output_classes ():
76
+ logger .warning (
77
+ f'Invocation "{ invocation_type } " has unregistered output class "{ output_annotation .__name__ } "'
78
+ )
79
+
69
80
if app_config .dev_reload :
70
81
# load_custom_nodes seems to bypass jurrigged's import sniffer, so be sure to call it *after* they're already
71
82
# imported.
0 commit comments