Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "ComfyStream",
// Commented out to use the build context instead
// TODO: Update this to the correct image name
// when using images other than livepeer/comfystream:latest
// "image": "livepeer/comfystream:streamdiffusion",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with comments here to allow for quick editing to test images other than livepeer/comfyui-base:latest

This was needed because devcontainer build failed with livepeer/comfyui-base:streamdiffusion as the BASE_IMAGE name.

"build": {
"dockerfile": "../docker/Dockerfile",
"context": "../"
Expand Down
74 changes: 74 additions & 0 deletions configs/QUICK_REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Quick Reference: Model Configuration

## Single File vs Directory Download

### Single File (Default)
```yaml
my-model:
name: "My Model"
url: "https://huggingface.co/user/repo/resolve/main/file.safetensors"
path: "loras/model.safetensors"
```

### Directory (Add `is_directory: true`)
```yaml
my-directory:
name: "My Directory"
url: "https://huggingface.co/user/repo/tree/main/folder"
path: "models/folder"
is_directory: true # ← Add this!
```

## URL Patterns

| Download Type | URL Pattern | Example |
|---------------|-------------|---------|
| **Single File** | `/resolve/` | `https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.safetensors` |
| **Directory** | `/tree/` | `https://huggingface.co/h94/IP-Adapter/tree/main/models/image_encoder` |

## Common Model Paths

| Model Type | Path Pattern |
|------------|--------------|
| Checkpoints | `checkpoints/SD1.5/` |
| LoRAs | `loras/SD1.5/` |
| ControlNet | `controlnet/` |
| VAE | `vae/` or `vae_approx/` |
| IP-Adapter | `ipadapter/` |
| Text Encoders | `text_encoders/CLIPText/` |
| TensorRT/ONNX | `tensorrt/` |

## IP-Adapter Example

```yaml
models:
# Single file - IP-Adapter model
ip-adapter-sd15:
name: "IP Adapter SD15"
url: "https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.safetensors"
path: "ipadapter/ip-adapter_sd15.safetensors"

# Directory - CLIP image encoder
clip-image-encoder:
name: "CLIP Image Encoder"
url: "https://huggingface.co/h94/IP-Adapter/tree/main/models/image_encoder"
path: "ipadapter/models/image_encoder"
is_directory: true
```

## Usage

```bash
# Use a config
python src/comfystream/scripts/setup_models.py --config my-config.yaml

# Use default config (models.yaml)
python src/comfystream/scripts/setup_models.py
```

## See Also

- [DIRECTORY_DOWNLOADS.md](../DIRECTORY_DOWNLOADS.md) - Detailed directory download guide
- [models-ipadapter-example.yaml](models-ipadapter-example.yaml) - Complete working example
- [README.md](README.md) - Full configuration reference

17 changes: 17 additions & 0 deletions configs/build_targets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# build_targets.yaml
# Maps node names to their build scripts and config files.
# Add new nodes as needed.

streamdiffusion:
script: /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/scripts/build_tensorrt_engines.py
configs:
- /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/configs/sd15_singlecontrol.yaml
- /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/configs/sdturbo_multicontrol.yaml
folder: /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/scripts

# Example for another node:
# depthanything:
# script: /workspace/ComfyUI/custom_nodes/ComfyUI-DepthAnything/scripts/build_depthanything_engine.py
# configs:
# - /workspace/ComfyUI/custom_nodes/ComfyUI-DepthAnything/configs/depthanything.yaml
# folder: /workspace/ComfyUI/custom_nodes/ComfyUI-DepthAnything/scripts
44 changes: 44 additions & 0 deletions configs/models-ipadapter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
models:
# Example: IP-Adapter setup with directory download

# Single file download (regular)
ip-adapter-plus-sd15:
name: "IP Adapter SD15"
url: "https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.safetensors"
path: "ipadapter/ip-adapter-plus_sd15.safetensors"
type: "ipadapter"
extra_files:
- url: "https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.bin"
path: "ipadapter/ip-adapter-plus_sd15.bin"

clip-image-encoder:
name: "CLIP Image Encoder"
url: "https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors"
path: "ipadapter/image_encoder/model.safetensors"
type: "image_encoder"
extra_files:
- url: "https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/config.json"
path: "ipadapter/image_encoder/config.json"

# Base model
sd-turbo:
name: "SD-Turbo"
url: "https://huggingface.co/stabilityai/sd-turbo/resolve/main/sd_turbo.safetensors"
path: "checkpoints/SD1.5/sd_turbo.safetensors"
type: "checkpoint"

PixelArtRedmond15V-PixelArt-PIXARFK.safetensors:
name: "PixelArtRedmond15V-PixelArt-PIXARFK"
url: "https://huggingface.co/artificialguybr/pixelartredmond-1-5v-pixel-art-loras-for-sd-1-5/resolve/ab43d9e2cf8c9240189f01e9cdc4ca341362500c/PixelArtRedmond15V-PixelArt-PIXARFK.safetensors"
Copy link
Collaborator Author

@eliteprox eliteprox Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Models download uses PixelArtRedmond15V-PixelArt-PIXARFK.safetensors, but example workflow uses PixelArt.safetensors

path: "loras/SD1.5/PixelArt.safetensors"
type: "lora"

# TAESD for fast VAE
taesd:
name: "TAESD"
url: "https://huggingface.co/madebyollin/taesd/resolve/main/taesd_decoder.safetensors"
path: "vae_approx/taesd_decoder.safetensors"
type: "vae_approx"
extra_files:
- url: "https://huggingface.co/madebyollin/taesd/resolve/main/taesd_encoder.safetensors"
path: "vae_approx/taesd_encoder.safetensors"
36 changes: 36 additions & 0 deletions configs/nodes-streamdiffusion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
nodes:
# Minimal node configuration for faster builds
comfyui-tensorrt:
name: "ComfyUI TensorRT"
url: "https://github.com/yondonfu/ComfyUI_TensorRT.git"
branch: "quantization_with_controlnet_fixes"
type: "tensorrt"
dependencies:
- "tensorrt==10.12.0.36"

comfyui-streamdiffusion:
name: "ComfyUI StreamDiffusion"
url: "https://github.com/muxionlabs/ComfyUI-StreamDiffusion"
branch: "main"
type: "tensorrt"

comfyui-torch-compile:
name: "ComfyUI Torch Compile"
url: "https://github.com/yondonfu/ComfyUI-Torch-Compile"
type: "tensorrt"

comfyui_controlnet_aux:
name: "ComfyUI ControlNet Auxiliary"
url: "https://github.com/Fannovel16/comfyui_controlnet_aux"
type: "controlnet"

comfyui-stream-pack:
name: "ComfyUI Stream Pack"
url: "https://github.com/livepeer/ComfyUI-Stream-Pack"
branch: "main"
type: "utility"

rgthree-comfy:
name: "rgthree Comfy"
url: "https://github.com/rgthree/rgthree-comfy.git"
type: "utility"
13 changes: 9 additions & 4 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
ARG BASE_IMAGE=nvidia/cuda:12.8.1-devel-ubuntu22.04 \
CONDA_VERSION=latest \
PYTHON_VERSION=3.12
PYTHON_VERSION=3.12 \
NODES_CONFIG=nodes.yaml

FROM "${BASE_IMAGE}"

ARG CONDA_VERSION \
PYTHON_VERSION
PYTHON_VERSION \
NODES_CONFIG

ENV DEBIAN_FRONTEND=noninteractive \
TensorRT_ROOT=/opt/TensorRT-10.12.0.36 \
Expand Down Expand Up @@ -56,6 +58,9 @@ RUN apt-get remove --purge -y libcudnn9-cuda-12 libcudnn9-dev-cuda-12 || true &&
# to ensure numpy 2.0 is not installed automatically by another package
RUN conda run -n comfystream --no-capture-output pip install "numpy<2.0.0"

# Ensure modelopt pulls a compatible transformers version for HF support
RUN conda run -n comfystream --no-capture-output pip install 'nvidia-modelopt[hf]'

# Install cuDNN 9.8 via conda to match base system version
# Caution: Mixed versions installed in environment (system/python) can cause CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH errors
RUN conda install -n comfystream -y -c nvidia -c conda-forge cudnn=9.8 cuda-version=12.8
Expand Down Expand Up @@ -105,8 +110,8 @@ RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream py
ARG CACHEBUST=static
ENV CACHEBUST=${CACHEBUST}

# Run setup_nodes
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI
# Run setup_nodes with custom config if specified
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI --config ${NODES_CONFIG}

# Setup opencv with CUDA support
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream --no-capture-output docker/entrypoint.sh --opencv-cuda
Expand Down
43 changes: 35 additions & 8 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ComfyStream Docker
# ComfyStream Docker Build Configuration

This folder contains the Docker files that can be used to run ComfyStream in a containerized fashion or to work on the codebase within a dev container. This README contains the general usage instructions while the [Devcontainer Readme](../.devcontainer/README.md) contains instructions on how to use Comfystream inside a dev container and get quickly started with your development journey.

Expand All @@ -7,21 +7,48 @@ This folder contains the Docker files that can be used to run ComfyStream in a c
- [Dockerfile](Dockerfile) - The main Dockerfile that can be used to run ComfyStream in a containerized fashion.
- [Dockerfile.base](Dockerfile.base) - The base Dockerfile that can be used to build the base image for ComfyStream.

## Pre-requisites
## Building with Custom Nodes Configuration

- [Docker](https://docs.docker.com/get-docker/)
- [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
The base Docker image supports specifying a custom nodes configuration file during build time using the `NODES_CONFIG` build argument.

## Usage
### Usage

### Build the Base Image
#### Default build (uses `nodes.yaml`)
```bash
docker build -t livepeer/comfyui-base -f docker/Dockerfile .
```

To build the base image, run the following command:
#### Build with custom config from configs directory
```bash
docker build -f docker/Dockerfile.base \
--build-arg NODES_CONFIG=nodes-streamdiffusion.yaml \
-t comfyui-base:streamdiffusion .
```

#### Build with config from absolute path
```bash
docker build -t livepeer/comfyui-base -f docker/Dockerfile.base .
docker build -f docker/Dockerfile.base \
--build-arg NODES_CONFIG=/path/to/custom-nodes.yaml \
-t comfyui-base:custom .
```

### Available Build Arguments

| Argument | Default | Description |
|----------|---------|-------------|
| `BASE_IMAGE` | `nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04` | Base CUDA image |
| `CONDA_VERSION` | `latest` | Miniconda version |
| `PYTHON_VERSION` | `3.12` | Python version |
| `NODES_CONFIG` | `nodes.yaml` | Nodes configuration file (filename or path) |
| `CACHEBUST` | `static` | Cache invalidation for node setup |

### Configuration Files in configs/

- **`nodes.yaml`** - Full node configuration (default)
- **`nodes-streamdiffusion.yaml`** - Minimal set of nodes for faster builds

### Examples

### Build the Main Image

To build the main image, run the following command:
Expand Down
Loading
Loading