YanWenKun / ComfyUI-Windows-Portable

🎨ComfyUI standalone pack with 30+ custom nodes. | ComfyUI 大号整合包,预装大量自定义节点(不含SD模型)
GNU General Public License v3.0
162 stars 20 forks source link
comfyui stable-diffusion

Portable package for ComfyUI on Windows

image::docs/screenshot.webp["Screenshot"]

[.text-center] English | link:README.zh.adoc[中文]

Just like https://github.com/comfyanonymous/ComfyUI/releases[ComfyUI official Standalone Portable], but preloaded with numerous custom nodes and Python packages, with all dependencies resolved.

The rest of README was translated by ChatGPT and edited by me (how lazy, how good😙).

== Features

** link:https://github.com/MrForExample/ComfyUI-3D-Pack[ComfyUI-3D-Pack] which you may want to spend less time on installing.

** Nodes like link:https://github.com/Gourieff/comfyui-reactor-node[ReActor Node] and https://github.com/ltdrdata/ComfyUI-Impact-Pack[Impact Pack] that download model files on the first run (may cause freezing for users with bad Internet Connection)

** See <<custom-nodes, Full List>>

== How to Use

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

  2. Download the package files from the release page: https://github.com/YanWenKun/ComfyUI-Windows-Portable/releases Note that there are multiple files (compressed in volumes) that need to be downloaded and extracted.

  3. Place SD models in ComfyUI\models\checkpoints. ** Subdirectories can be created for better organization.

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

** 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 https://github.com/comfyanonymous/ComfyUI/commit/9953f22fce0ba899da0676a0b374e5d1f72bf259[magic].

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

== Important Prerequisites For 3D-Pack Users

Few steps before running Comfy3D:

  1. Install Visual Studio Build Tools 2022 ( https://visualstudio.microsoft.com/downloads/?q=build+tools[Page] | https://aka.ms/vs/17/release/vs_BuildTools.exe[EXE] ). During the setup, select "Desktop development with C++" workload. You only need these two optional components:

MSVC Build Tools (compilers and libraries) CMake for C++ on Windows ** Note: Some PyTorch extension code needs to be compiled during runtime, so the build tools are needed. If you already installed Visual Studio with C++ workload, just skip this step.

  1. Install https://developer.nvidia.com/cuda-12-4-1-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_network[CUDA Toolkit 12.4.1]. Only https://github.com/YanWenKun/ComfyUI-Windows-Portable/raw/refs/heads/main/docs/cuda-toolkit-install-selection.webp[Libraries and Compilers] are needed.

  2. Edit run_nvidia_gpu.bat, reduce TORCH_CUDA_ARCH_LIST according to your https://github.com/ashawkey/stable-dreamfusion/issues/360#issuecomment-2292510049[GPU arch], to save your time on JIT compiling.

After successfully launching ComfyUI and loading the ComfyUI-3D-Pack, it is recommended to first run the TripoSR workflow, as the model files required for this workflow are smaller, execute faster, and have a high success rate.

== Tips for Usage

  1. Model Path: If model files are already saved in another location and you don't want to move them, you can configure the program to load them: Rename extra_model_paths.yaml.example in the ComfyUI directory to extra_model_paths.yaml. Edit extra_model_paths.yaml according to the directory structure, removing corresponding comments. ** Items other than base_path can be added or removed freely to map newly added subdirectories; the program will try load all of them.

  2. Proxy: If a network proxy is needed, edit run_nvidia_gpu.bat and add the following at the beginning: [source,cmd] set HTTP_PROXY=http://localhost:1081 set HTTPS_PROXY=http://localhost:1081

  3. Manager: Take advantage of the ComfyUI-Manager (the Manager button located at the bottom right corner of the ComfyUI page) to install additional custom nodes, update ComfyUI and nodes, or disable unnecessary nodes. ** If you find that some unused nodes affect the startup time, you can disable them.

  4. Language: Click the gear (⚙) icon at the top right corner of the ComfyUI page to modify settings. Find AGLTranslation to change the language (default is English, options are {Chinese, Japanese, Korean}).

  5. How to upgrade: ComfyUI-Manager can do most updates, but if you want a "fresh" upgrade, you can first delete the python_embeded directory, and then extract the same-named directory from the new version's package to the original location. Additional "try fix" in ComfyUI-Manager may be needed.

== Details

[[custom-nodes]] === Pre-installed Custom Node List

.Workspace [cols=2] === link:https://github.com/ltdrdata/ComfyUI-Manager[ComfyUI Manager] link:https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation[ComfyUI Translations] link:https://github.com/crystian/ComfyUI-Crystools[Crystools] link:https://github.com/pydn/ComfyUI-to-Python-Extension[ComfyUI-to-Python-Extension]
===
.General [cols=2] === link:https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git[Comfyroll Studio] link:https://github.com/cubiq/ComfyUI_essentials[ComfyUI Essentials by cubiq] link:https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes.git[Derfuu Modded Nodes] link:https://github.com/pythongosssss/ComfyUI-Custom-Scripts[Custom Scripts by pythongosssss] link:https://github.com/jags111/efficiency-nodes-comfyui[Efficiency Nodes by jags111] link:https://github.com/kijai/ComfyUI-KJNodes[KJNodes] link:https://github.com/bash-j/mikey_nodes[Mikey Nodes] link:https://github.com/rgthree/rgthree-comfy[rgthree Nodes] link:https://github.com/shiimizu/ComfyUI_smZNodes[smZ(shiimizu) Nodes] link:https://github.com/chrisgoringe/cg-use-everywhere[Use Everywhere] link:https://github.com/WASasquatch/was-node-suite-comfyui[WAS Node Suite] link:https://github.com/yolain/ComfyUI-Easy-Use[ComfyUI-Easy-Use]
===
.Control [cols=2] === link:https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet[Advanced ControlNet] link:https://github.com/Fannovel16/comfyui_controlnet_aux[ControlNet Auxiliary Preprocessors] link:https://github.com/ltdrdata/ComfyUI-Impact-Pack[Impact Pack] link:https://github.com/ltdrdata/ComfyUI-Inspire-Pack[Inspire Pack] link:https://github.com/cubiq/ComfyUI_InstantID[InstantID by cubiq] link:https://github.com/cubiq/ComfyUI_IPAdapter_plus[IPAdapter plus] link:https://github.com/cubiq/PuLID_ComfyUI[PuLID by cubiq] link:https://github.com/huchenlei/ComfyUI-layerdiffuse[LayerDiffuse] link:https://github.com/florestefano1975/comfyui-portrait-master[Portrait Master] link:https://github.com/Gourieff/comfyui-reactor-node[ReActor Node] link:https://github.com/mcmonkeyprojects/sd-dynamic-thresholding[SD Dynamic Thresholding] link:https://github.com/twri/sdxl_prompt_styler[SDXL Prompt Styler] link:https://github.com/storyicon/comfyui_segment_anything[Segment Anything]
===
.Video [cols=2] === link:https://github.com/MrForExample/ComfyUI-AnimateAnyone-Evolved[AnimateAnyone Evolved] link:https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved[AnimateDiff Evolved] link:https://github.com/FizzleDorf/ComfyUI_FizzNodes[FizzNodes] link:https://github.com/Fannovel16/ComfyUI-Frame-Interpolation[Frame Interpolation (VFI)] link:https://github.com/melMass/comfy_mtb[MTB Nodes] link:https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite[Video Helper Suite]
===
.More [cols=2] === link:https://github.com/MrForExample/ComfyUI-3D-Pack[3D Pack by MrForExample] link:https://github.com/cubiq/ComfyUI_FaceAnalysis[Face Analysis by cubiq] link:https://github.com/SLAPaper/ComfyUI-Image-Selector[Image Selector] link:https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git[Ultimate SD Upscale] link:https://github.com/pythongosssss/ComfyUI-WD14-Tagger[WD 1.4 Tagger] link:https://github.com/city96/ComfyUI-GGUF[ComfyUI-GGUF]
===

Most of the popular custom nodes are denpendency-compatible. You can install more custom nodes through ComfyUI-Manager.

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

[[xformers]] === About xFormers

The cross-attention mechanism in PyTorch 2.2+ performs well on Windows and is more consistent (albeit subtly), so it's understandable why the ComfyUI official package chose not to include xFormers.

However, there is still a strong demand for xFormers in 3D and video-related components, so it has been retained for compatibility.

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

There is no definitive conclusion about the performance of the two; specific testing is required.

[[build-your-own]] == Creating Your Own AIO Package

image:https://github.com/YanWenKun/ComfyUI-Windows-Portable/actions/workflows/build.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Windows-Portable/actions/workflows/build.yml"]

This repository utilizes a pipeline to build the integration 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 link:https://github.com/YanWenKun/ComfyUI-Windows-Portable/actions/workflows/build.yml[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.

== Temp Files

image::docs/sandboxie.avif["file diff",width=40%]

Files detected by Sandboxie as shown in the image; registry changes are not clear.

If you need to configure a sandbox, it is recommended to set the program directory (the parent directory of ComfyUI) to "Full Access" under "Resource Access."

.Complaints In my personal experience, I use a sandbox not so much for security considerations but mainly to avoid various Python packages downloading files haphazardly. Especially Huggingface Hub likes to download to %USERPROFILE%\.cache, and some rough and ready nodes directly call its downloader, downloading Git LFS blob files rather than individual model files, which are neither intuitive nor convenient for copying and reusing. Of course, despite the complaints, sandboxing is mainly for easy cleaning of temporary files.

.Advertisement Linux/WSL2 users may want to check out my link:https://github.com/YanWenKun/ComfyUI-Docker[ComfyUI-Docker], which is the exact opposite of the Windows integration package in terms of being large and comprehensive but difficult to update. I designed the Docker image with a meticulous eye, selecting a series of non-conflicting and latest version dependencies, and adhering to the KISS principle by only including ComfyUI-Manager, leaving the choice of custom nodes to the users. Not to mention the benefits of easy upgrades, easy cleanup, and secure isolation provided by container runtime itself.

== 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 comfyanonymous did. Because dependency relationships are too tricky, I went straight to pip install for dependency solving.

== Development Memo

== See Also

== Thanks

Thanks to the link:https://github.com/comfyanonymous/ComfyUI/tree/master/.github/workflows[ComfyUI GitHub workflow], from which I drew inspiration. The initial code was also copied from there.