From f1d1fb78cf5be7822c71046be8a7d7d1776754ff Mon Sep 17 00:00:00 2001 From: Neo Date: Wed, 12 Nov 2025 21:38:34 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=94=AF=E6=8C=81Concurrent-8=20by?= =?UTF-8?q?=E7=B1=B3=E5=BC=BA=E6=BB=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comfy/cli_args.py | 2 ++ main.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 2f30b72d2981..ffb15becf484 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -205,6 +205,8 @@ def is_valid_directory(path: str) -> str: parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.") +parser.add_argument("--num-workers", type=int, default=1, help="Set the number of worker threads to process the queue (default: 1). Increase this for better concurrency but be aware of GPU memory limitations.") + parser.add_argument( "--comfy-api-base", type=str, diff --git a/main.py b/main.py index e1b0f1620bbc..a02e8c5a4fb4 100644 --- a/main.py +++ b/main.py @@ -336,7 +336,10 @@ def start_comfyui(asyncio_loop=None): prompt_server.add_routes() hijack_progress(prompt_server) - threading.Thread(target=prompt_worker, daemon=True, args=(prompt_server.prompt_queue, prompt_server,)).start() + num_workers = max(1, args.num_workers) + logging.info(f"Starting {num_workers} worker thread(s) for queue processing") + for i in range(num_workers): + threading.Thread(target=prompt_worker, daemon=True, args=(prompt_server.prompt_queue, prompt_server,), name=f"PromptWorker-{i+1}").start() if args.quick_test_for_ci: exit(0) From cce156043f17ff6a8d8705668dbad4950de12f22 Mon Sep 17 00:00:00 2001 From: Neo Date: Wed, 12 Nov 2025 23:54:43 +0800 Subject: [PATCH 2/6] update tokenizers>=0.14,<0.19 is required for a normal functioning of this module, but found tokenizers==0.13.3. --- requirements.txt | 230 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 201 insertions(+), 29 deletions(-) diff --git a/requirements.txt b/requirements.txt index 249c36dee8c1..e92a10d6eb10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,29 +1,201 @@ -comfyui-frontend-package==1.28.8 -comfyui-workflow-templates==0.2.11 -comfyui-embedded-docs==0.3.1 -torch -torchsde -torchvision -torchaudio -numpy>=1.25.0 -einops -transformers>=4.37.2 -tokenizers>=0.13.3 -sentencepiece -safetensors>=0.4.2 -aiohttp>=3.11.8 -yarl>=1.18.0 -pyyaml -Pillow -scipy -tqdm -psutil -alembic -SQLAlchemy -av>=14.2.0 - -#non essential dependencies: -kornia>=0.7.1 -spandrel -pydantic~=2.0 -pydantic-settings~=2.0 +aiofiles==24.1.0 +aiohappyeyeballs==2.6.1 +aiohttp==3.11.8 +aiohttp_socks==0.10.1 +aiosignal==1.4.0 +aiosmtplib==3.0.1 +alembic==1.16.4 +amqp==5.3.1 +annotated-types==0.7.0 +anyio==3.7.1 +asgiref==3.9.1 +async-timeout==4.0.3 +attrs==25.3.0 +autobahn==24.4.2 +Automat==25.4.16 +av==14.2.0 +bcrypt==4.3.0 +billiard==4.2.1 +captcha==0.5.0 +celery==5.5.3 +certifi==2025.7.14 +cffi==1.17.1 +chardet==5.2.0 +charset-normalizer==3.4.2 +click==8.2.1 +click-didyoumean==0.3.1 +click-plugins==1.1.1.2 +click-repl==0.3.0 +comfyui-embedded-docs==0.3.0 +comfyui_frontend_package==1.28.8 +comfyui_workflow_templates==0.2.4 +constantly==23.10.4 +cos-python-sdk-v5==1.9.25 +crcmod==1.7 +cryptography==45.0.5 +daphne==4.2.1 +dashscope==1.14.1 +decorator==4.4.2 +distro==1.9.0 +dnspython==2.7.0 +ecdsa==0.19.1 +einops==0.8.1 +email-validator==2.1.0 +fastapi==0.104.1 +fastapi-pagination==0.13.3 +filelock==3.19.1 +flower==2.0.1 +frozenlist==1.7.0 +fsspec==2025.9.0 +gitdb==4.0.12 +GitPython==3.1.45 +greenlet==3.2.3 +gunicorn==23.0.0 +h11==0.16.0 +h2==4.2.0 +hf-xet==1.1.10 +hpack==4.1.0 +http_client==0.1.22 +httpcore==1.0.9 +httptools==0.6.4 +httpx==0.25.2 +huggingface-hub==0.35.1 +humanize==4.13.0 +Hypercorn==0.17.3 +hyperframe==6.1.0 +hyperlink==21.0.0 +idna==3.10 +imageio==2.37.0 +imageio-ffmpeg==0.6.0 +incremental==24.7.2 +Jinja2==3.1.6 +jiter==0.10.0 +jsonpatch==1.33 +jsonpointer==3.0.0 +jsonschema==4.25.1 +jsonschema-specifications==2025.9.1 +kombu==5.5.4 +kornia==0.7.1 +langchain==0.3.27 +langchain-core==0.3.74 +langchain-text-splitters==0.3.9 +langgraph==0.6.5 +langgraph-checkpoint==2.1.1 +langgraph-prebuilt==0.6.4 +langgraph-sdk==0.2.0 +langsmith==0.4.14 +Mako==1.3.10 +markdown-it-py==4.0.0 +MarkupSafe==3.0.2 +matrix-nio==0.25.2 +mdurl==0.1.2 +moviepy==1.0.3 +mpmath==1.3.0 +multidict==6.6.4 +mysql-connector-python==9.4.0 +networkx==3.5 +numpy==2.3.3 +nvidia-cublas-cu12==12.1.3.1 +nvidia-cuda-cupti-cu12==12.1.105 +nvidia-cuda-nvrtc-cu12==12.1.105 +nvidia-cuda-runtime-cu12==12.1.105 +nvidia-cudnn-cu12==9.1.0.70 +nvidia-cufft-cu12==11.0.2.54 +nvidia-cufile-cu12==1.13.1.3 +nvidia-curand-cu12==10.3.2.106 +nvidia-cusolver-cu12==11.4.5.107 +nvidia-cusparse-cu12==12.1.0.106 +nvidia-cusparselt-cu12==0.7.1 +nvidia-nccl-cu12==2.20.5 +nvidia-nvjitlink-cu12==12.8.93 +nvidia-nvtx-cu12==12.1.105 +openai==1.97.1 +orjson==3.11.2 +ormsgpack==1.10.0 +packaging==25.0 +passlib==1.7.4 +Pillow==10.0.1 +priority==2.0.0 +proglog==0.1.12 +prometheus_client==0.22.1 +prompt_toolkit==3.0.52 +propcache==0.3.2 +psutil==7.1.0 +pyasn1==0.6.1 +pyasn1_modules==0.4.2 +pycparser==2.22 +pycryptodome==3.23.0 +pycurl==7.45.7 +pydantic==2.11.7 +pydantic_core==2.33.2 +pydantic-settings==2.10.1 +pydub==0.25.1 +PyGithub==2.8.1 +Pygments==2.19.2 +PyJWT==2.10.1 +PyMySQL==1.1.0 +PyNaCl==1.6.0 +pyOpenSSL==25.1.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.0 +python-jose==3.3.0 +python-multipart==0.0.6 +python-socks==2.7.2 +pytz==2025.2 +PyYAML==6.0.2 +redis==6.2.0 +referencing==0.37.0 +regex==2025.9.18 +requests==2.31.0 +requests-toolbelt==1.0.0 +rich==14.2.0 +rpds-py==0.28.0 +rsa==4.9.1 +safetensors==0.4.2 +scipy==1.16.2 +sentencepiece==0.2.1 +service-identity==24.2.0 +shellingham==1.5.4 +six==1.17.0 +smmap==5.0.2 +sniffio==1.3.1 +soundfile==0.13.1 +spandrel==0.4.1 +SQLAlchemy==2.0.41 +starlette==0.27.0 +sympy==1.14.0 +tenacity==9.1.2 +tokenizers==0.15.2 +toml==0.10.2 +torch==2.4.0 +torchaudio==2.4.0 +torchsde==0.2.6 +torchvision==0.19.0 +tornado==6.5.2 +tqdm==4.67.1 +trampoline==0.1.2 +transformers==4.37.2 +triton==3.0.0 +Twisted==25.5.0 +txaio==25.6.1 +typer==0.20.0 +typing_extensions==4.14.1 +typing-inspection==0.4.1 +tzdata==2025.2 +uni-sdk==0.2.0 +unisms==0.0.7 +unpaddedbase64==2.1.0 +urllib3==2.5.0 +uv==0.9.5 +uvicorn==0.24.0 +uvloop==0.21.0 +vine==5.1.0 +watchfiles==1.1.0 +wcwidth==0.2.13 +websockets==15.0.1 +wsproto==1.2.0 +xmltodict==0.14.2 +xxhash==3.5.0 +yarl==1.18.0 +zope.interface==7.2 +zstandard==0.23.0 From aa33e4d49d0b15def25b87a9a8e680a8ea7e119b Mon Sep 17 00:00:00 2001 From: Neo Date: Fri, 14 Nov 2025 01:49:50 +0800 Subject: [PATCH 3/6] loose req --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index e92a10d6eb10..bf95e6ca38a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -167,10 +167,10 @@ sympy==1.14.0 tenacity==9.1.2 tokenizers==0.15.2 toml==0.10.2 -torch==2.4.0 -torchaudio==2.4.0 +torch>=2.0.0 +torchaudio>=2.0.0 torchsde==0.2.6 -torchvision==0.19.0 +torchvision>=0.15.0 tornado==6.5.2 tqdm==4.67.1 trampoline==0.1.2 From a39336a8f5913b1dc63e2a2d0c8c5c0922603feb Mon Sep 17 00:00:00 2001 From: Neo Date: Sun, 16 Nov 2025 01:08:40 +0800 Subject: [PATCH 4/6] use specific versions;CPUonly --- requirements.txt | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/requirements.txt b/requirements.txt index bf95e6ca38a3..f2a3ad4a7678 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +--extra-index-url https://download.pytorch.org/whl/cpu + aiofiles==24.1.0 aiohappyeyeballs==2.6.1 aiohttp==3.11.8 @@ -55,7 +57,7 @@ h11==0.16.0 h2==4.2.0 hf-xet==1.1.10 hpack==4.1.0 -http_client==0.1.22 +http-client==0.1.22 httpcore==1.0.9 httptools==0.6.4 httpx==0.25.2 @@ -95,20 +97,6 @@ multidict==6.6.4 mysql-connector-python==9.4.0 networkx==3.5 numpy==2.3.3 -nvidia-cublas-cu12==12.1.3.1 -nvidia-cuda-cupti-cu12==12.1.105 -nvidia-cuda-nvrtc-cu12==12.1.105 -nvidia-cuda-runtime-cu12==12.1.105 -nvidia-cudnn-cu12==9.1.0.70 -nvidia-cufft-cu12==11.0.2.54 -nvidia-cufile-cu12==1.13.1.3 -nvidia-curand-cu12==10.3.2.106 -nvidia-cusolver-cu12==11.4.5.107 -nvidia-cusparse-cu12==12.1.0.106 -nvidia-cusparselt-cu12==0.7.1 -nvidia-nccl-cu12==2.20.5 -nvidia-nvjitlink-cu12==12.8.93 -nvidia-nvtx-cu12==12.1.105 openai==1.97.1 orjson==3.11.2 ormsgpack==1.10.0 @@ -167,15 +155,14 @@ sympy==1.14.0 tenacity==9.1.2 tokenizers==0.15.2 toml==0.10.2 -torch>=2.0.0 -torchaudio>=2.0.0 +torch==2.4.0 +torchaudio==2.4.0 torchsde==0.2.6 -torchvision>=0.15.0 +torchvision==0.19.0 tornado==6.5.2 tqdm==4.67.1 trampoline==0.1.2 transformers==4.37.2 -triton==3.0.0 Twisted==25.5.0 txaio==25.6.1 typer==0.20.0 From 4b19dde5fa719fe573d91d17bc72ccb129ca50ce Mon Sep 17 00:00:00 2001 From: Neo Date: Sun, 16 Nov 2025 23:17:04 +0800 Subject: [PATCH 5/6] google-cloud-storage==2.18.2 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index f2a3ad4a7678..e6ad54a175e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -51,6 +51,7 @@ frozenlist==1.7.0 fsspec==2025.9.0 gitdb==4.0.12 GitPython==3.1.45 +google-cloud-storage==2.18.2 greenlet==3.2.3 gunicorn==23.0.0 h11==0.16.0 From ff45672806289a3fa244e7e66127ce9d386c787f Mon Sep 17 00:00:00 2001 From: Neo Date: Mon, 17 Nov 2025 00:08:06 +0800 Subject: [PATCH 6/6] no gpu --- requirements.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/requirements.txt b/requirements.txt index e6ad54a175e2..3b9b0e6dbed6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,12 @@ +#################################### +# 注意,如果不慎安装了GPU版本,要: +# 1. 卸载现有的 torch 相关包 +# pip uninstall torch torchvision torchaudio triton -y +# 2. (可选)安装 CPU 版本的 PyTorch +# pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cpu +#################################### + + --extra-index-url https://download.pytorch.org/whl/cpu aiofiles==24.1.0