diff --git a/README.md b/README.md index ebd985f..70405d6 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,43 @@ -# ComfyUI-Distributed +
+ +

+Video Tutorial +Setup Guides +Workflows +Donation +Twitter +

+
-![Clipboard Image (3)](https://github.com/user-attachments/assets/19fdd1be-8f6e-4df5-bcd9-538ef566fa82) +> **A powerful extension for ComfyUI that enables distributed and parallel processing across multiple GPUs and machines. Generate more images and videos and accelerate your upscaling workflows by leveraging all available GPU resources in your network.** -> **Supercharge your ComfyUI workflows with multi-GPU processing** - -A powerful extension for ComfyUI that enables parallel and distributed processing across multiple GPUs and machines. Speed up your image generation and upscaling workflows by leveraging all available GPU resources in your network. - -📺 [Watch the Tutorial](https://www.youtube.com/watch?v=p6eE3IlAbOs) +![Clipboard Image (7)](https://github.com/user-attachments/assets/66aaadef-f195-48a1-a368-17dd0dae477d) --- ## Key Features #### Parallel Workflow Processing -- **Parallel Generation** - Run the same workflow on multiple GPUs simultaneously with different seeds -- **Automatic Load Balancing** - Distribute workflow execution across available workers -- **Batch Acceleration** - Generate multiple variations faster by using all your GPUs +- Run workflows on multiple GPUs simultaneously with varied seeds +- Scale output with more workers +- Supports images and videos #### Distributed Upscaling -- **True Distributed Processing** - Split large upscaling tasks into tiles processed across multiple GPUs -- **Tile-based Upscaling** - Intelligent work distribution for Ultimate SD Upscale +- Accelerate Ultimate SD Upscale by distributing tiles across GPUs +- Intelligent distribution +- Handles single images and batches -#### Management & Monitoring -- **Automatic Worker Management** - Launch and monitor workers from the UI -- **Network Support** - Use GPUs across different machines on your network -- **Real-time Monitoring** - Track worker status and performance from the UI -- **Easy Configuration** - JSON-based configuration with UI controls -- **Memory Management** - Built-in VRAM clearing +#### Ease of Use +- Auto-setup local workers; easily add remote/cloud ones +- Convert any workflow to distributed with 2 nodes +- JSON configuration with UI controls --- ## Requirements -- ComfyUI installation +- ComfyUI +> Note: Desktop app not currently supported - Multiple GPUs - That's it @@ -44,131 +49,50 @@ A powerful extension for ComfyUI that enables parallel and distributed processin ```bash git clone https://github.com/robertvoy/ComfyUI-Distributed.git ``` + +2. **Restart ComfyUI** - If you'll be using remote/cloud workers, add `--enable-cors-header` to your launch arguments on the master -2. **Restart ComfyUI** - If you'll be using remote workers, add `--enable-cors-header` to your launch arguments - ---- - -## Quick Start - -### Adding Local Workers -![Distributed GPU Panel](https://github.com/user-attachments/assets/9c1d6d0e-3fd1-43e3-97c4-7c6bf2952b19) -> Local Workers: Additional ComfyUI instances running on the same computer (with multi-GPUs) as your main ComfyUI installation. - -1. **Open** the Distributed GPU panel. -2. **Click** "Add Worker" in the UI. -3. **Configure** your local worker: - - **Name**: A descriptive name for the worker (e.g., "My Gaming PC GPU 0") - - **Port**: A unique port number for this worker (e.g., 8189, 8190...). - - **CUDA Device**: The GPU index from `nvidia-smi` (e.g., 0, 1). - - **Extra Args**: Optional ComfyUI arguments for this specific worker. -4. **Save** and optionally launch the local worker. - -### Adding Remote Workers -📺 [Watch the Tutorial](https://www.youtube.com/watch?v=p6eE3IlAbOs) - -> Remote Workers: ComfyUI instances running on completely different computers on your network. These allow you to harness GPU power from other machines. Remote workers must be manually started on their respective computers and are connected via IP address. - -1. **On the Remote Worker Machine:** - - **Launch** ComfyUI with the `--listen --enable-cors-header` arguments. ⚠️ **Required!** - - **Add** workers in the UI panel if the remote machine has more than one GPU. - - Make sure that they also have `--listen` set in `Extra Args`. - - Then launch them. - - **Open** the configured worker port(s) (e.g., 8189, 8190) in the remote worker's firewall. - -2. **On the Main Machine:** - - **Open** the Distributed GPU panel (sidebar on the left). - - **Click** "Add Worker." - - **Enable** "Remote Worker" checkbox. - - **Configure** your remote worker: - - **Name**: A descriptive name for the worker (e.g., "Server Rack GPU 0") - - **Host**: The remote worker's IP address. - - **Port**: The port number used when launching ComfyUI on the remote worker (e.g., 8189). - - **Save** the remote worker configuration. - -
-💡 Tip: Using GPUs Outside Your Local Network - -Services like [Tailscale](https://tailscale.com) create secure VPN connections that make remote computers appear as if they're on your local network. This lets you use GPUs from: -- **Other locations** (work computer, friend's gaming PC, etc.) -- **Cloud instances** (AWS, Google Cloud, etc.) -- **Any internet-connected machine** with CUDA GPUs - -Just install Tailscale on both machines and use the Tailscale IP address as the "Host" when configuring your remote worker. - -
- -### Configuration Tips - -| Setting | Description | Example | -|---------|-------------|---------| -| **CUDA Devices** | Use `nvidia-smi` to see GPU indices | 0, 1, 2... | -| **Ports** | Each worker needs a unique port | 8189, 8190... | -| **Extra Args** | Additional ComfyUI arguments | See below | - -**Common Extra Args:** -- `--listen` - **Required** for remote workers -- `--enable-cors-header` - **Required** if using remoter workers -- `--lowvram` - For GPUs with less memory -- `--highvram` - For high-end GPUs -- `--reserve-vram 2` - Reserves 2GB of VRAM. Recommended for your primary/display GPU - ---- - -## Nodes - -### Distributed Collector -> Collects and combines results from distributed processing - -**Usage**: Place after any image generation node to enable distributed processing. Works automatically when workers are enabled. - -### Distributed Seed -> Ensures unique seeds across distributed workers for varied generations - -**Usage**: Connect to any seed input. Each worker automatically receives an offset seed to ensure randomisation. Alternatively, you can connect a seed node directly to this node's seed input, which will automatically handle seed offsetting across all workers. - -### Ultimate SD Upscale Distributed -> Distributed version of Ultimate SD Upscale that processes tiles across multiple GPUs, making upscaling much faster - -**Usage**: -1. Upscale your image with a regular upscale model (ESRGAN, etc.) -2. Feed the upscaled image into this node -3. Configure tile settings -4. Enable workers for fast processing - ---- - -## UI Features - -### Distributed GPU Panel - -The control centre for your distributed setup: - -| Feature | Description | -|---------|-------------| -| **Worker Status** | Real-time status indicators | -| **Launch/Stop** | Control individual local workers | -| **Clear Memory** | Free VRAM on all workers | -| **Interrupt** | Stop current processing | -| **Worker Logs** | View real-time logs | +3. Read the [setup guide](https://github.com/robertvoy/ComfyUI-Distributed/blob/feature/cloud-workers/docs/worker-setup-guides.md) for adding workers --- ## Workflow Examples -### Basic Distributed Generation +### Basic Parallel Generation +Generate multiple images in the time it takes to generate one. Each worker uses a different seed. -![Clipboard Image (1)](https://github.com/user-attachments/assets/e8e46d97-d698-4c18-b4e5-1e1a2f4f7da3) +![Clipboard Image (6)](https://github.com/user-attachments/assets/9598c94c-d9b4-4ccf-ab16-a21398220aeb) -1. Create your normal ComfyUI workflow +> [Download workflow](/workflows/distributed-txt2img.json) + +1. Open your ComfyUI workflow 2. Add **Distributed Seed** → connect to sampler's seed 3. Add **Distributed Collector** → after VAE Decode 4. Enable workers in the UI 5. Run the workflow! -### Distributed Upscaling +### Parallel WAN Generation +Generate multiple videos in the time it takes to generate one. Each worker uses a different seed. -![Clipboard Image (2)](https://github.com/user-attachments/assets/ec2548d0-1fc7-4705-801f-3270d720cfce) +![Clipboard Image (5)](https://github.com/user-attachments/assets/5382b845-833b-43b7-b238-a91c5579581a) + +> [Download workflow](/workflows/distributed-wan.json) + +1. Open your WAN ComfyUI workflow +2. Add **Distributed Seed** → connect to sampler's seed +3. Add **Distributed Collector** → after VAE Decode +4. Add **Image Batch Divider** → after Distributed Collector +5. Set the `divide_by` to the number of GPUs you have available +> For example: if you have a master and 2x workers, set it to 3 +7. Enable workers in the UI +8. Run the workflow! + +### Distributed Upscaling +Accelerate the process by distributing tiles across multiple workers, with speed scaling as you add more GPUs. + +![Clipboard Image (3)](https://github.com/user-attachments/assets/ffb57a0d-7b75-4497-96d2-875d60865a1a) + +> [Download workflow](/workflows/distributed-txt2img.json) 1. Load your image 2. Upscale with ESRGAN or similar @@ -178,85 +102,45 @@ The control centre for your distributed setup: --- -## Troubleshooting - -### Common Issues +## FAQ
-Workers won't start - -- Check ports are not in use: `netstat -an | grep 8189` -- Verify CUDA device exists: `nvidia-smi` -- Check ComfyUI path in worker logs +Does it combine VRAM of multiple GPUs? +No, it does not combine VRAM of multiple GPUs.
-"Worker not managed by UI" message - -- Worker was started outside the UI -- Stop the worker manually and use the UI to relaunch +Does it speed up the generation of a single image or video? +No, it does not speed up the generation of a single image or video. Instead, it enables the generation of more images or videos simultaneously. However, it can speed up the upscaling of a single image when using the Ultimate SD Upscale Distributed feature.
-Images not combining properly - -- Ensure all remote workers have the same models available -- Check that custom nodes are installed on all remote workers +Does it work with the ComfyUI desktop app? +Currently, it is not compatible with the ComfyUI desktop app.
-Network connection issues - -- Check firewall settings for required ports -- Verify master IP is accessible: `ping 192.168.1.100` -- Ensure same ComfyUI version on all machines -- Ensure ComfyUI-Distributed is installed on remote workers +Can I combine my RTX 5090 with a GTX 980 to get faster results? +Yes, you can combine different GPUs, but performance is optimized when using similar GPUs. A significant performance imbalance between GPUs may cause bottlenecks. For upscaling, setting `static_distribution` to `false` allows the faster GPU to handle more processing, which can mitigate some bottlenecks. Note that this setting only applies to upscaling tasks.
-Custom validation failed for node: image - Invalid image file - -- Add `--enable-cors-header` to your launch argument, on both master and remote worker +Does this work with cloud providers? +Yes, it is compatible with cloud providers. Refer to the setup guides for detailed instructions.
-"Could not find main.py in /basedir" error when using Docker - -- If you are running a worker in a Docker container (e.g., using `mmartial/comfyui-nvidia-docker`), you might encounter an error indicating `main.py` cannot be found in `/basedir`, preventing the worker from launching or finding custom nodes. -- **Solution**: Add the following flags to the "Extra Args" field when configuring the worker in the ComfyUI-Distributed UI: - `--base-dir /basedir --enable-cors-header --listen 0.0.0.0` - This ensures that the base directory within the Docker container is correctly set, allowing ComfyUI to locate its necessary files and custom nodes. +Can I make this work with my Docker setup? +Yes, it is compatible with Docker setups, but you will need to configure your Docker environment yourself. Unfortunately, assistance with Docker configuration is not provided.
-## UI Panel Settings - -The Distributed GPU panel includes several configuration options in the Settings section: - -### Debug Mode -- **Description**: Enable detailed logging for troubleshooting and monitoring distributed operations -- **Default**: Disabled -- **Usage**: When enabled, detailed debug information is logged to the browser console, including worker status updates, job distribution details, and network communication logs - -### Auto-launch Workers on Startup -- **Description**: Automatically launch enabled local workers when ComfyUI starts -- **Default**: Disabled -- **Usage**: When enabled, any local workers that are marked as "enabled" will be automatically launched in the background when the ComfyUI server starts, eliminating the need to launch each worker manually - -### Stop Workers on Master Exit -- **Description**: Automatically stop all managed local workers when the master ComfyUI instance shuts down -- **Default**: Enabled -- **Usage**: When enabled, ensures clean shutdown by stopping all UI-managed worker processes when the main ComfyUI server exits, preventing orphaned background processes - --- -## Development +## Disclaimer -This project is under active development. Contributions are welcome! +This software is provided "as is" without any warranties, express or implied, including merchantability, fitness for a particular purpose, or non-infringement. The developers and copyright holders are not liable for any claims, damages, or liabilities arising from the use, modification, or distribution of the software. Users are solely responsible for ensuring compliance with applicable laws and regulations and for securing their networks against unauthorized access, hacking, data breaches, or loss. The developers assume no liability for any damages or incidents resulting from misuse, improper configuration, or external threats. -### Planned Features +--- -- [x] Support for Cloud workers (release coming soon) -- [ ] Remote worker control via SSH -- [ ] View remote worker logs in UI -- [ ] Improve worker timeout logic -- [ ] ComfyUI Desktop app compatibility +## Support the Project +If my custom nodes have added value to your workflow, consider fueling future development with a coffee! Your support helps keep this project thriving. Buy me a coffee at: https://buymeacoffee.com/robertvoy \ No newline at end of file