diff --git a/comfy/cli_args.py b/comfy/cli_args.py index f89a7aab482..c9eba0edcda 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -118,6 +118,12 @@ class LatentPreviewMethod(enum.Enum): upcast.add_argument("--dont-upcast-attention", action="store_true", help="Disable all upcasting of attention. Should be unnecessary except for debugging.") +manager_group = parser.add_mutually_exclusive_group() +manager_group.add_argument("--disable-manager", action="store_true", help="Completely disable the ComfyUI-Manager feature.") +manager_group.add_argument("--disable-manager-ui", action="store_true", help="Disables only the ComfyUI-Manager UI and endpoints. Scheduled installations and similar background tasks will still operate.") +manager_group.add_argument("--enable-manager-legacy-ui", action="store_true", help="Enables the legacy UI of ComfyUI-Manager") + + vram_group = parser.add_mutually_exclusive_group() vram_group.add_argument("--gpu-only", action="store_true", help="Store and run everything (text encoders/CLIP models, etc... on the GPU).") vram_group.add_argument("--highvram", action="store_true", help="By default models will be unloaded to CPU memory after being used. This option keeps them in GPU memory.") @@ -154,6 +160,7 @@ class PerformanceFeature(enum.Enum): parser.add_argument("--verbose", default='INFO', const='DEBUG', nargs="?", choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Set the logging level') parser.add_argument("--log-stdout", action="store_true", help="Send normal process output to stdout instead of stderr (default).") + # The default built-in provider hosted under web/ DEFAULT_VERSION_STRING = "comfyanonymous/ComfyUI@latest" diff --git a/main.py b/main.py index f3f56597a75..ac916224b9b 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,9 @@ import logging import sys +if not args.disable_manager: + import comfyui_manager + if __name__ == "__main__": #NOTE: These do not do anything on core ComfyUI which should already have no communication with the internet, they are for custom nodes. os.environ['HF_HUB_DISABLE_TELEMETRY'] = '1' @@ -77,6 +80,11 @@ def execute_script(script_path): for possible_module in possible_modules: module_path = os.path.join(custom_node_path, possible_module) + + if not args.disable_manager: + if comfyui_manager.should_be_disabled(module_path): + continue + if os.path.isfile(module_path) or module_path.endswith(".disabled") or module_path == "__pycache__": continue @@ -96,6 +104,10 @@ def execute_script(script_path): logging.info("") apply_custom_paths() + +if not args.disable_manager: + comfyui_manager.prestartup() + execute_prestartup_script() @@ -269,6 +281,9 @@ def start_comfyui(asyncio_loop=None): prompt_server = server.PromptServer(asyncio_loop) q = execution.PromptQueue(prompt_server) + if not args.disable_manager and not args.disable_manager_ui: + comfyui_manager.start() + hook_breaker_ac10a0.save_functions() nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes) hook_breaker_ac10a0.restore_functions() diff --git a/nodes.py b/nodes.py index 73a62d93035..188c67d1608 100644 --- a/nodes.py +++ b/nodes.py @@ -38,6 +38,9 @@ import latent_preview import node_helpers +if not args.disable_manager: + import comfyui_manager + def before_node_execution(): comfy.model_management.throw_exception_if_processing_interrupted() @@ -2172,6 +2175,12 @@ def init_external_custom_nodes(): module_path = os.path.join(custom_node_path, possible_module) if os.path.isfile(module_path) and os.path.splitext(module_path)[1] != ".py": continue if module_path.endswith(".disabled"): continue + + if not args.disable_manager: + if comfyui_manager.should_be_disabled(module_path): + logging.info(f"Blocked by policy: {module_path}") + continue + time_before = time.perf_counter() success = load_custom_node(module_path, base_node_names, module_parent="custom_nodes") node_import_times.append((time.perf_counter() - time_before, module_path, success)) diff --git a/requirements.txt b/requirements.txt index f64a05947cb..9c64996d35f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ comfyui-frontend-package==1.17.11 comfyui-workflow-templates==0.1.3 +comfyui_manager torch torchsde torchvision