Skip to content

feat: Support ComfyUI-Manager for pip version #7555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions comfy/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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"

Expand Down
15 changes: 15 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand All @@ -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()


Expand Down Expand Up @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
comfyui-frontend-package==1.17.11
comfyui-workflow-templates==0.1.3
comfyui_manager
torch
torchsde
torchvision
Expand Down
Loading