-
Notifications
You must be signed in to change notification settings - Fork 7
/
__init__.py
50 lines (38 loc) · 1.24 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import importlib
import traceback
import time
extras = [
".ConditioningBlend",
".DebugThis",
".VAEEncodeForInpaint",
".VividSharpen",
".ksampler_sequence",
".BLVaeEncode"
]
PREFIX = '\33[31m\33[94m[WAS Extras]\33[0m '
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
module_timings = {}
print(f"{PREFIX}Loading extra custom nodes...")
for module_name in extras:
start_time = time.time()
success = True
error = None
try:
module = importlib.import_module(module_name, package=__name__)
except Exception as e:
error = e
success = False
traceback.print_exc()
end_time = time.time()
timing = end_time - start_time
if success:
module_timings[module.__file__] = (timing, success, error)
NODE_CLASS_MAPPINGS.update(getattr(module, 'NODE_CLASS_MAPPINGS', {}))
NODE_DISPLAY_NAME_MAPPINGS.update(getattr(module, 'NODE_DISPLAY_NAME_MAPPINGS', {}))
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
print(f"{PREFIX} Import times for extras:")
for module, (timing, success, error) in module_timings.items():
print(f" {timing:.1f} seconds{('' if success else ' (IMPORT FAILED)')}: {module}")
if error:
print("Error:", error)