File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,6 @@ def run_app() -> None:
49
49
# Miscellaneous startup tasks.
50
50
apply_monkeypatches ()
51
51
register_mime_types ()
52
- if app_config .dev_reload :
53
- enable_dev_reload ()
54
52
check_cudnn (logger )
55
53
56
54
# Initialize the app and event loop.
@@ -61,6 +59,11 @@ def run_app() -> None:
61
59
# core nodes have been imported so that we can catch when a custom node clobbers a core node.
62
60
load_custom_nodes (custom_nodes_path = app_config .custom_nodes_path , logger = logger )
63
61
62
+ if app_config .dev_reload :
63
+ # load_custom_nodes seems to bypass jurrigged's import sniffer, so be sure to call it *after* they're already
64
+ # imported.
65
+ enable_dev_reload (custom_nodes_path = app_config .custom_nodes_path )
66
+
64
67
# Start the server.
65
68
config = uvicorn .Config (
66
69
app = app ,
Original file line number Diff line number Diff line change 1
1
import logging
2
2
import mimetypes
3
3
import socket
4
+ from pathlib import Path
4
5
5
6
import torch
6
7
@@ -33,8 +34,9 @@ def check_cudnn(logger: logging.Logger) -> None:
33
34
)
34
35
35
36
36
- def enable_dev_reload () -> None :
37
+ def enable_dev_reload (custom_nodes_path = None ) -> None :
37
38
"""Enable hot reloading on python file changes during development."""
39
+ import invokeai
38
40
from invokeai .backend .util .logging import InvokeAILogger
39
41
40
42
try :
@@ -44,7 +46,10 @@ def enable_dev_reload() -> None:
44
46
'Can\' t start `--dev_reload` because jurigged is not found; `pip install -e ".[dev]"` to include development dependencies.'
45
47
) from e
46
48
else :
47
- jurigged .watch (logger = InvokeAILogger .get_logger (name = "jurigged" ).info )
49
+ paths = [str (Path (invokeai .__file__ ).with_name ("*.py" ))]
50
+ if custom_nodes_path :
51
+ paths .append (str (custom_nodes_path / "*.py" ))
52
+ jurigged .watch (pattern = paths , logger = InvokeAILogger .get_logger (name = "jurigged" ).info )
48
53
49
54
50
55
def apply_monkeypatches () -> None :
You can’t perform that action at this time.
0 commit comments