Skip to content

Latest commit

 

History

History
302 lines (216 loc) · 12.5 KB

README.adoc

File metadata and controls

302 lines (216 loc) · 12.5 KB

Portable package for ComfyUI on Windows

Screenshot

English | 中文说明

Just like ComfyUI official Standalone Portable, but preloaded with numerous custom nodes and Python packages, with all dependencies resolved.

NEW: A Dedicated Package for ComfyUI-3D-Pack

For better compatibility, I made a dedicated package for ComfyUI-3D-Pack:

New releases of this ComfyUI-Windows-Portable will not include 3D-Pack. Previous releases will remain unchanged.

Features

  • Pre-installed with 40+ commonly-used custom nodes. [Full List]

    • With all the model files that need to be downloaded on the first run (which may cause freezing for users with a poor Internet connection).

  • Includes 240+ mutually compatible Python packages, including:

    • insightface, dlib, etc., which require compilation during installation.

    • xFormers, which is not included in the ComfyUI official package for an understandable reason. It may not be significant for text-to-image, but could be useful for video workflows.

  • Only a few functional models are pre-installed; users please prepare SD models of your favorite.

  • This repo uses the GitHub pipeline for packaging, making it easy for DIY. No need to configure CI/CD, simply fork the repository on GitHub to run the packaging script. See Creating Your Own AIO Package.

How to Use

  1. Only NVIDIA GPUs are supported, preferably with the latest driver installed.

  2. Install Git for Windows. The setup will prompt you with several options; it’s fine to use the default settings for all of them.

  3. Download the package files from the release page:

  4. Place SD models in ComfyUI\models\checkpoints.

    • Subdirectories can be created for better organization.

  5. Edit and run run_nvidia_gpu.bat to start ComfyUI.

    • If you need to config HTTP proxy, follow the instruction in this file.

    • If you don’t want the browser to open automatically, add --disable-auto-launch to the startup arguments.

    • If you’re using 40/Ada series or newer GPU, you can try adding --fast to the startup arguments. It has magic.

  6. After starting, the program will automatically open a browser, or you can visit: http://localhost:8188/

  7. Change language: Click the gear (⚙) icon at the bottom left corner of the ComfyUI page to modify settings. Find AGL to change the language (default is English, options are {Chinese, Japanese, Korean, Russian}).

Tips and Tricks

  1. Take full advantage of ComfyUI-Manager (the Manager button in the top-right corner of the ComfyUI page) to manage custom nodes: install, update, disable, and uninstall.

    • Be cautious when using "Update All"; there’s no need to update unused nodes to avoid Python package conflicts.

  2. To disable xFormers, add --use-pytorch-cross-attention to the ComfyUI startup parameters.

    • This will enable the native PyTorch cross-attention. Once enabled, the time, VRAM usage, and image consistency for SD image generation may vary slightly.

    • It is recommended not to disable xFormers if you plan to generate videos.

  3. For power users, consider using Sandboxie to limit cache files while isolating the environment.

    • For better I/O performance when using Sandboxie, it is recommended to configure the program’s main directory (ComfyUI_Windows_portable) as "Open Access" in "Sandbox Options" → "Resource Access".

4. External Model Directories

ComfyUI can load model files from directories outside of the main directory. Here’s how to configure it:

  • Rename extra_model_paths.yaml.example in the ComfyUI directory to remove the .example suffix.

  • Edit extra_model_paths.yaml, where lines starting with # are comments.

Example file (click to expand)
comfyui:
    base_path: D:\models\
    animatediff_models: animatediff_models
    animatediff_motion_lora: animatediff_motion_lora
    bert-base-uncased: bert-base-uncased
    checkpoints: checkpoints
    clip: clip
    clip_vision: clip_vision
    configs: configs
    controlnet: controlnet
    depthfm: depthfm
    diffusers: diffusers
    embeddings: embeddings
    facerestore_models: facerestore_models
    gligen: gligen
    grounding-dino: grounding-dino
    hypernetworks: hypernetworks
    insightface: insightface
    ipadapter: ipadapter
    loras: loras
    mmdets: mmdets
    onnx: onnx
    photomaker: photomaker
    reactor: reactor
    sams: sams
    style_models: style_models
    ultralytics: ultralytics
    unet: unet
    upscale_models: upscale_models
    vae: vae
    vae_approx: vae_approx

5. External HuggingFace Hub Directory

ComfyUI has three main locations for saving model files:

  • The official models directory (and the aforementioned external model directory)

  • Model files downloaded locally by each node in custom_nodes

  • Model files downloaded via HuggingFace Hub (the official HF downloader)

By default, HF Hub downloads files to C:\Users\UserName\.cache\huggingface\hub. This package modifies this path to ComfyUI_Windows_portable\HuggingFaceHub in the startup script for easier file management.

If you have multiple ComfyUI instances and wants to share a common HF Hub model directory, modify the startup script as follows:

set HF_HUB_CACHE=%~dp0\HuggingFaceHub

To something like:

set HF_HUB_CACHE=D:\HuggingFaceHub

6. How to Perform a "Swap-Out and Swap-In" Style Major Update

This method bypasses ComfyUI-Manager updates and directly replaces the old package with a new version. If done correctly, it avoids installing or upgrading Python packages, thus preventing dependency version conflicts.

  1. First, install Git for Windows, and select Git Bash (default).

  2. Unzip the new version of pre-built package.

  3. Delete the ComfyUI and HuggingFaceHub folders in the new version.

  4. Copy the two folders from the old version into the new one.

  5. In the new main directory, open Git Bash (right-click in an empty area and select "Open Git Bash here").

  6. Copy and paste the following command in Git Bash (right-click to paste and hit Enter):

    bash force-update-all.sh
  1. Refer to the "How to Use" section to edit and run the startup script.

  2. If any nodes fail to load, you may need to click "try fix" in ComfyUI-Manager.

Details

Pre-installed Custom Node List

Table 1. Workspace

ComfyUI Manager

ComfyUI Translations

Crystools

ComfyUI-to-Python-Extension

Table 2. General

Comfyroll Studio

ComfyUI Essentials by cubiq

Derfuu Modded Nodes

Custom Scripts by pythongosssss

Efficiency Nodes by jags111

KJNodes

Mikey Nodes

rgthree Nodes

smZ(shiimizu) Nodes

Use Everywhere

WAS Node Suite

ComfyUI-Easy-Use

Table 3. Control

Advanced ControlNet

ControlNet Auxiliary Preprocessors

Impact Pack

Impact Subpack

Inspire Pack

InstantID by cubiq

IPAdapter plus

PuLID by cubiq

LayerDiffuse

Portrait Master

ReActor Node

SD Dynamic Thresholding

SDXL Prompt Styler

Segment Anything

Table 4. Video

AnimateAnyone Evolved

AnimateDiff Evolved

FizzNodes

Frame Interpolation (VFI)

MTB Nodes

Video Helper Suite

Table 5. More

Face Analysis by cubiq

Image Selector

Ultimate SD Upscale

WD 1.4 Tagger

ComfyUI-GGUF

If compatibility issues arise, you can try disabling conflicting nodes in ComfyUI-Manager.

Creating Your Own AIO Package

GitHub Workflow Status

This repository utilizes a pipeline to build the package, and the codebase doesn’t contain specific configurations or require additional access permissions. Hence, you can directly fork this repository to start executing the GitHub Workflow.

  1. After forking, go to Actions on the page.

  2. Locate Build & Upload Package.

    • For example, it looks like this on my repository page.

  3. Click Run Workflow.

  4. Wait about 20~40 minutes until the workflow run complete.

    • If you want to speed up the compression process, edit stage3.sh and set the parameters to -mx=3 -mfb=32 -md=4m. This adjustment will reduce the workflow duration to under 15 minutes, at the cost of a larger file size.

  5. Go to the releases page of your repository, where you’ll find the newly generated draft for download or publish.

Development Idea

Originally, the code was copied from ComfyUI’s GitHub workflow, but I found it difficult to debug, so I rewrote the script.

However, the packaging concept is similar: providing a self-contained, portable, and fully equipped environment with a pre-installed Python Embedded.

The difference is that I didn’t download wheels first and then install them in bulk like Comfy did. Because dependency relationships are too tricky, I went straight to pip install for dependency solving.

As a note, a common issue with Python Embedded in such pre-installed packages is that most of the executables in the Scripts directory cannot run properly. This is because these executables are often Python command wrappers that invoke python.exe through an absolute path. Once the directory changes (or is relocated), they naturally fail to execute. Fortunately, this does not affect the current project significantly.

Thanks

Thanks to the ComfyUI GitHub workflow, from which I drew inspiration.